2010年5月18日 星期二

RHEL5.3 Tuning-Tweaking Linux network parameters

Allow the TCP stack to reuse sockets in the TIME-WAIT state:
# Allow reuse/recycling of TIME-WAIT sockets for new connections:
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1

Lowering the FIN Timeout value will shorten the TIME_WAIT state, freeing up resources for new connections. It is recommended when running applications that constantly create a lot of new connections – ie. a web server. The default is 60, and Sun recommends a value in the 15-30 range.
# Lower FIN timeout (default: 60):
net.ipv4.tcp_fin_timeout = 15

Tweak the TCP KeepAlive values:
# Wait time between isAlive interval probes (default: 75, recommended: 15-30):
net.ipv4.tcp_keepalive_intvl = 15
# Number of probes before timing out (default: 9, recommended: 5):
net.ipv4.tcp_keepalive_probes = 5

The default maximum for send/receive windows is 128Kb and it’s recommended to boost this to 8Mb:
# Maximum TCP Send Window:
net.core.wmem_max = 8388608
# Maximum TCP Receive Window:
net.core.rmem_max = 8388608

Also tweak the IPv4 rcv/snd buffers to use a maximum of 8Mb:
# Memory reserved for TCP rcv buffers (default: 4Kb 85Kb 4Mb):
net.ipv4.tcp_rmem = 4096 87380 8388608
# Memory reserved for TCP snd buffers (default: 4Kb 16Kb 4Mb):
net.ipv4.tcp_wmem = 4096 87380 8388608

If you’re using a lot of connections, you should make more local ports available. Default range gives a total of 28232 ports available. Increasing this range to 4096-65535 will give you 61439 local ports:
# Available local port range (default: 32768 61000):
net.ipv4.ip_local_port_range = 4096 65536

摘自:http://blog.spind.net/2008/11/28/tweaking-linux-network-parameters/

沒有留言:

wibiya widget