[ovs-discuss] OVSDB connection keep-alive vs. echo RPC

Ben Pfaff blp at ovn.org
Thu Dec 7 18:04:28 UTC 2017


On Thu, Dec 07, 2017 at 12:24:51PM -0500, Matt Layher via discuss wrote:
> I'm working on implementing an OVSDB client in Go
> (https://godoc.org/github.com/digitalocean/go-openvswitch/ovsdb) and
> recently implemented the Echo RPC.
> 
> https://tools.ietf.org/html/rfc7047#section-4.1.11
> 
> According to the RFC, the purpose of Echo is "to verify the liveness of a
> database connection".  Does this mean that Echo should be used as a
> keep-alive of sorts for long-running connections?  I'm thinking about adding
> a background loop to my client that sends Echo RPCs at a regular interval
> for this purpose.

Yes, echo requests can be used for this purpose and that's their normal
use.

The C and Python libraries suppress this functionality by default when
they connect over a unix domain socket, because the kernel reliably
ensures that unix domain sockets stay connected.

> Next, if I were to connect to ovsdb-server via TCP instead of UNIX socket,
> would enabling TCP keep-alives serve the same purpose?

I believe that TCP keepalives only affect otherwise idle connections.
TCP keepalives normally operate very slowly, on the order of several
minutes to hours.  I also understand that they are not necessarily
end-to-end if the connection passes through some kinds of proxies etc.


> If neither of these approaches are necessary, it'd avoid adding some
> additional complexity to the code.  I'd be very curious to hear what folks
> have done.

The kernel does monitor TCP connections that have outstanding data to
make sure that they are still operational, but it takes minutes (up to
20 minutes in some situation if I recall correctly) to detect and
disconnect in that case.  We have found that echo requests and replies
are valuable in situations where we just can't wait that long.


More information about the discuss mailing list