TCP Tuning

From Wikitech

Suggested Wikipedia Front End server tweaks

initcwnd 10

This makes the initial congestion window of 10, as tested by google. Default is 3. "Overall, more than 90% of client connections have a large enough receive window to fully benefit from using init cwnd=10 segments." Currently the only majorly used OS with a smaller advertised receive window is Linux 2.6. Changing this on all servers is currently pointless, as the 2.6.32 kernel's receive window is stuck at 3 and cannot be increased.

  • How do we implement this without just having an ip route command script on startup ?
  • Double check this has no negative impact on internal communication using iperf (highly doubtful, but double check).

[1]

tcp_fin_timeout 30

Lower our tcp_fin_timeout by 30 seconds (default is 60 seconds). This matters if the other side does not respond to tcp_fin's. Currently on our caches about 2-3% of all connections are stuck in the FIN state. 75% of them are in FIN_WAIT2 (Connection is closed, and the socket is waiting for a shutdown from the remote end.) We can change this on all servers.

  • To implement we can use puppet managed files of sysctl.conf, or we can redo our puppet sysctl management system.

Future Tweaks

initrwnd 10

TCP Initial receive window bumped up to 10 from a default of 3. This currently can only be set in 2.6.33 onwards (we are currently using 2.6.32 in our lucid distro). Recommend that we up this to 10 once we upgrade to Precise Pangolin

  • This can be set with the "ip route" command - we should look for a more elegant way

Non tweaks

The tcp_rmem and tcp_wmem windows are already large and appear to be beyond the level where it would be an issue.