Salesforce

FAQ on TCP Keepalive for UNIX

« Go Back

Information

 
TitleFAQ on TCP Keepalive for UNIX
URL Name13493
Article Number000118304
EnvironmentProduct: OpenEdge
Version: Progress 9.x
OpenEdge 10.x, 11.x
OS: All Supported Operating Systems
Other: TCP/IP
Question/Problem Description
FAQ on TCP/IP Keepalive
What is TCP/IP Keepalive?
How to set up TCP/IP Keepalive?
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
Q: What is the Socket Keepalive Option?

A: The Keepalive socket is a process where periodic transmissions are made to ensure the connection is still operating properly.
 
Q: How do I know if my Socket implementation supports the Keepalive option?

A: Your system supports the Keepalive process if in the file usr/sys/socket.h, or /usr/include/sys/socket.h depending on the OS, the following line exists:
 
#define SO_KEEPALIVE 0x0008   /* keep connections alive */

Q: How long has the Keepalive process existed?

A: The Keepalive process is really a part of TCP/IP and has been around for many years.
 
Q: Is the Keepalive option the same for all platforms?

A: No. Keepalive is TCP/IP and Socket implementation specific. However, it should behave the same on most Progress platforms.
 
Q: Do other protocols have a similar process?

A: Yes, SPX has the so-called connection watchdog.
 
Q: When should you use the Keepalive process?

A: If you have clients who "go away" without telling the server, the Keepalive process properly terminates the connection/session.
 
Q: How can a client "go away" without telling the server?

A: If:
  • The client turns the machine off.
  • There is a hard network failure (for example, a cable problem).
  • The machine hangs.
 Q: Are there any side effects of the Keepalive?

A: The Keepalive process generates a few small probe packets. These packets have very small bandwidth requirements and should not affect performance.
 
Q: How long does it take to notice that a client has "gone away" using Keepalive?

A: It depends on kernel parameters.
 
Q: What are these kernel parameters?

A: In the file /usr/sys/netinet/tcp_times.h, there are three parameters:
  • On some platforms, this file is in: /usr/include/netinet/tcp_timer.h
#define TCPTV_KEEP_IDLE  /* default time before probing, idle time */
#define TCPTV_KEEPINTVL  /* default probe interval, time between probes */
#define TCPTV_KEEPCNT    /* max probes before drop */

Q: Can I change these parameters?

A: Yes, and then you must rebuild your kernel.
 
Q: Are there any side effects in changing these parameters?

A: Yes, all socket-based processes use the parameters such as rlogin or telnet. Hence, you should keep this in mind.
 
Q: Are there any guidelines for changing these parameters?

A: Yes
TCPTV_KEEP_IDLE should be greater than 15 mins.
TCPTV_KEEPINTVL should be greater than 1 min.
TCPTV_KEEPCNT should be greater than 6.
 
Q: How can I test if the Keepalive is working properly?

A: Start up a client and then cause a hard network failure pulling off the network cable. The server should disconnect the client based on the time specified by the above parameters. For example, in: /usr/sys/netinet/tcp_timer.h or /usr/include/netinet/tcp_timer.h
 
#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ)  /* two hours */
#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ)     /* 1 min 15 sec */
#define TCPTV_KEEPCNT   8                   /* number of failures */
 
After there is no activity on the socket for 2 hours, the server starts to probe the client every 75 seconds. If eight (8) of these probes fail, the server disconnects the client. In other words, it takes 2 hours and 10 mins to disconnect the client. Refer to Article  How to configure the Operating System TCP KEEPALIVE   
 
Q: Why is the TCPTV._KEEP_IDLE set to two hours?

A: Remember that the probing process generates network traffic and only start the probing after an extended idle time.  Since users (client) go to lunch, have meetings, etc. the server should not start to probe until the user has gone away for a relatively long time.
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:26 AM

Powered by