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?

IBM JDK seems** to provide a non-standard API for this already (not sure why 
this does not get automatically unified).

Greetings
Bernd

* An Oracle Whitepaper: Dead Connection Detection; March 2014; Bhaskar Mathur, 
Feroz Khan, Kant Patel (Oracle Corporation);
http://www.oracle.com/technetwork/database/enterprise-edition/oraclenetdcd-2179641.pdf
** http://www-01.ibm.com/support/docview.wss?uid=swg1IV01598
-- 
http://bernd.eckenfels.net

Reply via email to