System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring TCP KeepAlive Parameters

SOLVED
Go to solution
rustam_2
Super Advisor

Configuring TCP KeepAlive Parameters

Hi all,
I need to change some TCP parameters(KEEPALIVE_ TIME KEEPALIVE_INTERVAL KEEPALIVE_PROBES). The default values arent suitable for our softwares and oracle connection is active after lost connection.
I read several article, such as:
http://www.sybase.com/detail?id=611

http://www.starquest.com/Supportdocs/techStarLicense/SL002_TCPKeepAlive.shtml

http://oraforecast.com/orawiki/index.php/How_to_enable_Dead_Connection_Detection

So is it secure if i will change it on HP-UX 11.3? should i reboot my server after changing these values?
are steps in article ok? does HP have official docs for this?

Regards,
Rustam
6 REPLIES
Solution

Re: Configuring TCP KeepAlive Parameters

Normally you'd use ndd for setting the parameters with no reboot required, but if you want them to be set after the next boot too, then you'll need to edit /etc/rc.config.d/nddconf to make the changes permanent.

The parameters you're probably interested in are:

# ndd -get /dev/tcp ? | grep -i keep
tcp_keepalive_interval (read and write)
tcp_keepalives_kill (read and write)
tcp_keepalive_detached_interval(read and write)
tcp_keepalive_ext (read and write)


And, you can get informative help with "ndd -h":

# ndd -h tcp_keepalive_interval

tcp_keepalive_interval:

Interval for sending keep-alive probes.

If any activity has occurred on the connection or if there is
any unacknowledged data when the time-out period expires, the
timer is simply restarted. If the remote system has crashed
and rebooted, it will presumably know nothing about this
connection, and it will issue an RST in response to the ACK.
Receipt of the RST will terminate the connection.

If the keepalive packet is not ACK'd by the remote TCP, the normal
retransmission time-out will eventually exceed threshold R2,
and the connection will be terminated.

With this keepalive behavior, a connection can time-out and
terminate without actually receiving an RST from the remote TCP.
[10000, 10*24*3600000] Default: 2 * 3600000 (2 hours)

See "man ndd" for even more.
rick jones
Honored Contributor

Re: Configuring TCP KeepAlive Parameters

It would be better for individual applications to have their own application layer "keepalive" mechanism, but as suggested, you do not have to reboot your system after changing the relevant ndd settings. I suspect though that the settings will only take effect for TCP connections established *after* the ndd changes.
there is no rest for the wicked yet the virtuous have no pillows
rustam_2
Super Advisor

Re: Configuring TCP KeepAlive Parameters

Hi and thanks jack challen and rick jones.

Jack challen, so for keeping these parameters for all time (after several reboots) I need to edit file /etc/rc.config.d/nddconf instead ndd? I saw that there are help information, and no parameters. So should I add new parameters in this file with vi? I must have these values: KEEPALIVE_TIME =12 min, KEEPALIVE_PROBES= 7 min, KEEPALIVE_INTERVAL= 15 min. I should add these values in file?:
1)For keepalive_interval=15min ( 900 000 msec)
TRANSPORT_NAME[0]=tcp
NDD_NAME[0]=tcp_keepalive_interval
NDD_VALUE[0]= 900 000
2)I couldnt find parameter KEEPALIVE_TIME in ndd â h, so I can add these parameter in nddconf file? I need to add keepalive_time with 720 000 value.
3)Also couldnt find parameter keepalive_probes. But read some the same parameter tcp_keepalives_kill - (Types of keep-alive probe to use). Are they the same keepalive_probes and tcp_keepalives_kill? If arenâ t how can I set this value?

># ndd -get /dev/tcp ? | grep -i keep
>tcp_keepalive_interval (read and write)
>tcp_keepalives_kill (read and write)
>tcp_keepalive_detached_interval(read and write)
>tcp_keepalive_ext (read and write)

What means read and write? I didnt find information about keepalive_ext, for what I can use it?

># ndd -h tcp_keepalive_interval
>With this keepalive behavior, a connection can time-out and
>terminate without actually receiving an RST from the remote TCP.
>[10000, 10*24*3600000] Default: 2 * 3600000 (2 hours)
Yeah, thanks, I read that many OS has the value 2 hours.

Yeah, rick jones, I will hope that I dont need to reboot system and If I reboot in few years then these parameters will be alive from file /etc/rc.config.d/nddconf
rick jones
Honored Contributor

Re: Configuring TCP KeepAlive Parameters

Not appearing in ndd -h output (or "ndd /dev/tcp ?") output is not conclusive, it is a strong indication that the parameter does not exist. It wouldn't be the first time that database documentation writers got their OSes and/or network tunables confused.
there is no rest for the wicked yet the virtuous have no pillows
rustam_2
Super Advisor

Re: Configuring TCP KeepAlive Parameters

So rick jones, what do you think, what should and could i do? i need to change these parameters but dont know how.

Thank you for reading and helping.

Regards,
rustam

rick jones
Honored Contributor

Re: Configuring TCP KeepAlive Parameters

You could make tcp_keepalive_interval shorter if you wish - it won't really "hurt" anything to make it say 30 seconds, but it will be more traffic when you have "idle" connections. Ie, if you have connections that are often idle for more than 30 seconds, but less than two hours, setting tcp_keepalive_interval to 30 seconds will increase (slightly) the packets your system sends - the keepalive probes.

BTW, the read and write bit says that one can both read the parameter with ndd and write (aka set) the parameter with ndd.
there is no rest for the wicked yet the virtuous have no pillows