Linux – Best network tuning variables for a Linux proxy

linuxPROXYtcptuningweb-server

What are the best settings to tune so that Linux can handle a very large amount of TCP connections such as would be seen by a proxy server or a webserver?

I'm using Centos6 and squid and am seeing a large amount of TIME_WAIT connections backing up until finally the machine stops responding. The machine isn't loaded at the time, and is having trouble making ingoing and outgoing connections.

I've had several suggestions of tuning /proc/sys/net/ipv4/tcp_tw_reuse and /proc/sys/net/ipv4/tcp_tw_reuse but they mention bad interactions with load balancers and NAT both of which are used in my situation.

Best Answer

Try to tune down this one:

net.ipv4.tcp_keepalive_time = 7200

Something like

net.ipv4.tcp_keepalive_time = 600

should be a lot better for your situation.

Also, make sure you have tuned the local port range. By default in most distros it's

net.ipv4.ip_local_port_range = 32768    61000

Something like

net.ipv4.ip_local_port_range = 1025    65534

should work lot better.

Related Topic