html
TCP Background
Linux
There are a lot of differences between Linux version 2.4 and 2.6, so first
FreeBSD we'll cover the tuning issues that are the same in both 2.4 and 2.6. To
Solaris change TCP settings in, you add the entries below to the file
Windows XP
Windows Vista /etc/sysctl.conf, and then run "sysctl -p".
Mac OSX
Other Like all operating systems, the default maximum Linux TCP buffer sizes
More Info are way too small. I suggest changing them to the following settings:
Publications Note: you should leave tcp_mem alone. The defaults are fine.
O'Reilly Article
Usenix Article Another thing you can try that may help increase TCP throughput is to
Search increase the size of the interface queue. To do this, do the following:
Linux 2.4
However, Linux 2.4 has some other strange behavior that one needs to
be aware of. For example: The value for ssthresh for a given path is
cached in the routing table. This means that if a connection has has a
retransmition and reduces its window, then all connections to that host
for the next 10 minutes will use a reduced window size, and not even try
to increase its window. The only way to disable this behavior is to do the
following before all new connections (you must be root):
1 of 3 09/26/2007 09:26 AM
TCP Tuning Guide - Linux TCP Tuning http://www-didc.lbl.gov/TCP-tuning/linux.html
sysctl -w net.ipv4.route.flush=1
Linux 2.6
Linux 2.6 also includes and both send and receiver-side automatic buffer
tuning (up to the maximum sizes specified above). There is also a setting
to fix the ssthresh caching weirdness described above.
For very long fast paths, I suggest trying HTCP or BIC-TCP if Reno is
not is not performing as desired. To set this, do the following:
sysctl -w net.ipv4.tcp_congestion_control=htcp
Note: Linux 2.6.11 and under has a serious problem with certain Gigabit
and 10 Gig ethernet drivers and NICs that support "tcp segmentation
offload", such as the Intel e1000 and ixgb drivers, the Broadcom tg3,
2 of 3 09/26/2007 09:26 AM
TCP Tuning Guide - Linux TCP Tuning http://www-didc.lbl.gov/TCP-tuning/linux.html
and the s2io 10 GigE drivers. This problem was fixed in version 2.6.12.
A workaround for this problem is to use ethtool to disable segmentation
offload:
This will reduce your overall performance, but will make TCP over
LFNs far more stable.
More information on tuning parameters and defaults for Linux 2.6 are
available in the file ip-sysctl.txt, which is part of the 2.6 source
distribution.
And finally a warning for both 2.4 and 2.6: for very large BDP paths
where the TCP window is > 20 MB, you are likely to hit the Linux
SACK implementation problem. If Linux has too many packets in flight
when it gets a SACK event, it takes too long to located the SACKed
packet, and you get a TCP timeout and CWND goes back to 1 packet.
Restricting the TCP buffer size to about 12 MB seems to avoid this
problem, but clearly limits your total throughput. Another solution is to
disable SACK.
Linux 2.2
If you are still running Linux 2.2, upgrade! If this is not possible, add the
following to /etc/rc.d/rc.local
3 of 3 09/26/2007 09:26 AM