Rails Machine Wiki

Apache Max Clients

If you are running a busy site, you may need to change the Apache Maxclients parameter to keep your site running quickly.

The Problem
To determine whether you need to make this change, there are a few things you can check:
1. sudo netstat -anp | grep http | wc -l
You will notice the count of httpd connections remains around 150 or 250.
2. After restarting Apache (service httpd restart), the site will run more quickly, but will again approach a threshold of about 150 or 250 and remain constant, then the site will slow down again.

The Fix
In /etc/httpd/conf/httpd.conf, uncomment this line:

Include conf/extra/httpd-mpm.conf

Then change the mpm_worker_module section of /etc/httpd/conf/extra/httpd-mpm.conf:

<IfModule worker.c>
   StartServers 2
   ServerLimit 100
   MaxClients 2500
   MinSpareThreads 25
   MaxSpareThreads 75
   ThreadsPerChild 25
   MaxRequestsPerChild 0
</IfModule>

Now restart apache with service httpd restart. This will bump you up to 2500 simultaneous connections.