On 10/11/2017 06:09, Bernd Eckenfels wrote:

Hello,

TCP keepalive is a rather elegant mechanism to detect abandoned TCP Connections. With increased distribution of components and inclusion of Cloud based services I have the feeling it has become more important.

Yet it is rather clumsy to use, because in addition to actually enabling it in the application for every generated socket it also typically requires reconfiguration of the OS Settings, since the Defaults like 2h (Linux) to start the detection are nowhere near a useful short detection time.

On native applications there is therefore a trend to configure the times on a per-connection base with the appropriate APIs. For example a Oracle Database 12c reconfigures the TCP keepalive settings when the sqlnet.expire_time* setting is used.

For sockets used in OpenJDK/Oracle jvm there seems to be no way to configure per-connection Settings and there is also no global option to turn on keep-alive for Java applications which do not contain specific code. (This is especially a problem since there is also no OS switch to turn this on, so solutions like pre-loaded shared libraries have to be used, which is rather ugly)

-Djdk.net.tcpkeepalive=true ; set the keepalive option on all new sockets, allow the API to unset it selectively

I wonder what the idea here on the list is, would this be a interesting Addition to the socket Option API and a good System property?


I don't recall this coming up before. If it were to go ahead then it may have some spec implications, e.g. TCP_NODELAY is specified to be false by default in the API specs.

-Alan

Reply via email to