Skip to content

Instantly share code, notes, and snippets.

@hanut
Last active March 18, 2019 11:41
Show Gist options
  • Select an option

  • Save hanut/7ce99c7cb5a879b32aebb9c3235f68ab to your computer and use it in GitHub Desktop.

Select an option

Save hanut/7ce99c7cb5a879b32aebb9c3235f68ab to your computer and use it in GitHub Desktop.
Vertical Superscale
In Linux, TCP keepalive parameters are:
tcp_keepalive_intvl
tcp_keepalive_probes
tcp_keepalive_time
Their default values are:
tcp_keepalive_time = 7200 (seconds)
tcp_keepalive_intvl = 75 (seconds)
tcp_keepalive_probes = 9 (number of probes)
For example, to reduce the value of /proc/sys/net/ipv4/tcp_keepalive_time from 7,200 (2 hours)
to 300 (5 Min) we can use the command:
echo 300 > /proc/sys/net/ipv4/tcp_keepalive_time
OR
sysctl -w net.ipv4.tcp_keepalive_time=300
Both of these are temporary methods. To permanently change to TCP Keepalive add the following
to the /etc/sysctl.conf file -
net.ipv4.tcp_keepalive_time=300
NOTE: All the above commands require root user access to run.
Increase socket descriptors limit -
ulimit -n 18000000
Increase kernel socket descriptors limit -
echo 18000000 > /proc/sys/fs/nr_open
Configure available ephemeral ports -
sysctl -w net.ipv4.ip_local_port_range="500 65535"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment