Performance Tuning
June 18, 2005 Posted by KP
I have been considering to upgrade my 10 MB uplink, but after read the system tuning in the handbook, I realized something else was more important than the bandwidth limit, especially kern.ipc.somaxconn:
The default value 128 is typically too low for robust handling of new connections in a heavily loaded web server environment. For such environments, it is recommended to increase this value to 1024 or higher.
I raised kern.ipc.somaxconn to 1024 with the sysctl command:
# sysctl kern.ipc.somaxconn=1024
To avoid running this command every time the server reboots, I also added the following line to /etc/sysctl.conf:
kern.ipc.somaxconn=1024
Apache could be a bottleneck too. I also modified Apache configuration and did a graceful restart:
MaxKeepAliveRequests 200 (from 100)
MaxClients 300 (from 150)
Related Posts:
Filed Under: Apache
April 12th, 2008 at 7:03 am
Did upping somaxconn work?
More important than the MaxKeepAliveRequests and MaxClients in Apache is probably the KeepAliveTimeout.. If that’s too high, the all your server processes will be kept waiting on inactive connections.
I’m tweaking for pretty busy server - I’ve set KeepAliveTimeout to 3 seconds, and just upped somaxconn myself just now.
October 28th, 2008 at 5:29 pm
If you can, turn keepalive off and move all your static content to a dedicated server or a CDN.