← See all notes

Table of Contents

TCP optimizations

# These were taken from:
# - https://github.com/zchee/docker-h2o/blob/master/sysctl.conf
# - https://hpbn.co/building-blocks-of-tcp/

# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1

# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.core.wmem_default = 131072
net.core.wmem_max = 16777216

# Allow the TCP fastopen flag to be used, beware some firewalls do not like TFO! (kernel > 3.7)
net.ipv4.tcp_fastopen=3

# Avoid falling back to slow start after a connection goes idle
# keeps our cwnd large with the keep alive connections (kernel > 3.6)
net.ipv4.tcp_slow_start_after_idle=0

# This will ensure that immediatly subsequent connections use the new values
net.ipv4.route.flush = 1
net.ipv6.route.flush = 1

# Increase the initial congestion window (default is 10)
net.ipv4.tcp_initcwnd=15