http://www.performancewiki.com/linux-tuning.html
To view current TCP settings, run command:
root# sysctl net.ipv4.tcp_keepalive_time
net.ipv4.tcp_keepalive_time = 7200 // 2 hours
where net.ipv4.tcp_keepalive_time is a TCP tuning parameter.
To set a TCP parameter to a value, run command:
root# sysctl -w net.ipv4.tcp_keepalive_time=1800
A list of recommended TCP parameters, values, and their meanings:
Parameter Value
-------------------------------------------
net.ipv4.tcp_tw_reuse
net.ipv4.tcp_tw_recycle 1
Reuse sockets in the time-wait state
net.core.wmem_max 8388608
Increase the maximum write buffer queue size
net.core.rmem_max 8388608
Increase the maximum read buffer queue size
net.ipv4.tcp_rmem 4096 87380 8388608
Set the minimum, initial, and maximum sizes for the read buffer.
Note that this maximum should be less than or equal to the
value set in net.core.rmem_max.
net.ipv4.tcp_wmem 4096 87380 8388608
Set the minimum, initial, and maximum sizes for the write buffer.
Note that this maximum should be less than or equal to the
value set in net.core.wmem_max.
timeout_timewait echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
Determines the time that must elapse before TCP/IP can release
a closed connection and reuse its resources. This interval
between closure and release is known as the TIME_WAIT state or
twice the maximum segment lifetime (2MSL) state. During this
time, reopening the connection to the client and server cost
less than establishing a new connection. By reducing the value
of this entry, TCP/IP can release closed connections faster,
providing more resources for new connections. Adjust this
parameter if the running application requires rapid release,
the creation of new connections, and a low throughput due to
many connections sitting in the TIME_WAIT state.
===========================================================================
http://www.softpanorama.org/Commercial_linuxes/performance_tuning.shtml
These reduce the amount of work the TCP stack has to do:
echo 0 > /proc/sys/net/ipv4/tcp_sack
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
[ check security ]
===========================================================================
http://fasterdata.es.net/TCP-tuning/linux.html
TCP Tuning Guide
Version 1.0
Fri, 2 Apr 2010
Linux TCP Tuning
There are a lot of differences between Linux version 2.4 and 2.6, so first
we'll cover the tuning issues that are the same in both 2.4 and 2.6. To change
TCP settings in, you add the entries below to the file /etc/sysctl.conf,
and then run "sysctl -p".
Like all operating systems, the default maximum Linux TCP buffer sizes are
way too small. I suggest changing them to the following settings:
# increase TCP max buffer size setable using setsockopt()
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
You should also verify that these are all set to the default value of 1:
sysctl net.ipv4.tcp_window_scaling
sysctl net.ipv4.tcp_timestamps
sysctl net.ipv4.tcp_sack
Note: you should leave tcp_mem alone, the defaults are fine.