Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ipvs-connection-timeout-issue IPVS模式下服务间长连接通讯的优化,解决Connection reset by peer问题 #688

Merged
merged 1 commit into from
Sep 8, 2019

Conversation

JaeGerW2016
Copy link

ipvsadm -l --timeout
Timeout (tcp tcpfin udp): 900 120 300
sysctl net.ipv4.tcp_keepalive_time net.ipv4.tcp_keepalive_probes net.ipv4.tcp_keepalive_intvl
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 75

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.

@gjmzj gjmzj merged commit 4e81cb1 into easzlab:master Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants