Tuesday, February 26, 2008

TCP optimizations and sysctl

Time and again, I have needed to tweak a server running a variety of TCP/IP application(s) so that it shows some improvement with some simple steps. I am not a System Administrator, so the quickest trick for me is to tweak simple TCP characteristics:

a) Increase TCP window size
b) Enable TCP SYN cookies. This prevents SYN floods on incoming connections
c) Increase TCP send and receive buffers
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

All these are edits to /etc/sysctl.conf which is a configuration file to configure/edit kernel parameters at runtime.

#sysctl -p /etc/sysctl.conf
to enable your changes, and
#sysctl -a
to see what else has been configured.

No comments: