fix: ipvs-connection-timeout-issue IPVS模式下服务间长连接通讯的优化,解决Connection reset by peer问题 #688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enable keepalive at the TCP or application network layers:
TCP Keepalive. In Linux TCP keepalive parameters can be set when opening the socket. The default TCP keepalive settings (sysctls) are:
net.ipv4.tcp_keepalive_time = 7200: seconds idle before sending the first probe
net.ipv4.tcp_keepalive_intvl = 75: seconds between probes
net.ipv4.tcp_keepalive_probes = 9: number of probes to fail before considering the session failed
The following are the required socket options:
SO_KEEPALIVE = 1 -- enable keepalive. Keep alive must be enabled by the application upon socket creation. There is no OS-level configuration to globally enable TCP keepalive in Linux.
TCP_KEEPIDLE = 600 -- send first probe after 10 minutes idle. This can be set on the host via sysctl ipv4.tcp_keepalive_time. However, containers on kernel 4.13 and later will not inherit this sysctl from the host, and as of EE Engine 18.09 setting sysctls with swarm mode services is not yet supported.
Application keepalive. Reconfigure or modify the application to send some data periodically (heartbeat) over otherwise quiet TCP sessions.
Reconfigure or modify affected TCP client applications to close idle TCP sessions prior to the 15 minute timeout.