Apache Server Reached MaxClients Setting
Apache Server Reached MaxClients Setting
by Jeff on June 6th, 2014 No Comments »
 , ,

Restored!
Original Publish Date - June 24, 2011

Recently, one of our Apache web servers triggered an alert stating the HTTPD service was down with a Socket Error. Upon further investigation, I found the following line in our /var/log/httpd/error.log

[Fri Jun 24 10:41:57 2011] [error] server reached MaxClients setting, consider raising the MaxClients setting

The MaxClients setting is found in the httpd.conf file under /etc/httpd/conf (CentOS). Our setting was as follows


StartServers      50
MinSpareServers   10
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000

So our MaxClients will be 256. After reading several articles advising against increasing this numbers, I found one that actually provided an algorithm for finding a suitable number.

MaxClients = RAM(mb) / Max process size(mb)

The Max Process Size can be found with the following command, note that the size is in KB, so you will need to divide that by 1024.

ps -ylC httpd --sort:rss

Look at the highest number under RSS. In my case, it was 11,000 (11,000/1024)=10.7mb (round up to 11 to be safe) and I have 4gb of RAM (4*1024)=4096. This means that my MaxClients could theoretically be raised to (4096/11) 372 (rounded down).

Note: If you increase the MaxClients, you must increase the ServerLimit to match


Leave a Reply

Your email address will not be published. Required fields are marked *