TCP keepalive in *nix

Posted by Rob Fitzpatrick on 17-Feb-2012 18:00

I have a couple of Linux database servers with the following (default) TCP keepalive settings:

keepalive_time: 7200

keepalive_intvl: 75

keepalive_probes: 9

I take it that this means a dead TCP connection, e.g. a remote 4GL or SQL client's socket, could linger for over two hours before the kernel cleans it up (and the broker is aware that it is gone).  From what I have read, this default is much longer than is ideal, and that something like 10 minutes is more reasonable.

The response I got from my unix adminstrator (without providing any sources), was that "these are the historical industry standard settings for Linux", and "they are not recommended to be changed in the operating system".  I think that's bunk.

Are these settings that you typically change from the defaults when you provision an application or database server?  If so, what values do you think are more appropriate?

Follow-up question: are there some other "must-change" OS defaults that you always alter when you provision a DB server, e.g. setting "noatime" on file systems, or setting "fsize" to unlimited?

All Replies

Posted by gus on 20-Feb-2012 09:00

Your UNIX administrator is correct that these are "historical" default settings. There is nothing magical about them. Some programmer at Berkeley picked those values 30 years ago because they seemed reasonable. Since then its been "that's the way we always do it".

The reason that it is possible to change the settings is because "One size fits all" is just not true. Sometimes other values are more appropriate. Many people change them.

However: they are system-wide settings so they will affect more than just the database servers. For example, if you use NFS, then this will affect it too.

This thread is closed