Tuning Max Clients

Please note: this article was originally created for our previous generation of Virtual Private Servers. As such, these instructions may not be relevant to our current generation of Virtual Private Servers.

The MaxClients directive is used to set a limit on the number of simultaneous requests that can be supported. No more than this number of child server processes will be created. If you wish to configure more than 256 clients, you will need to edit the HARD_SERVER_LIMIT entry in the file httpd.h and recompile. The calculation of MaxClients is rather straightforward:
                              Total RAM Dedicated to the Webserver
MaxClients = —————————————————
                              MAX child’s process size

If your wondering what will happen to your server if there are more concurrent users than MaxClients at any time, you will see the following warning message in the error_log:

[Sun Jan 06 12:05:32 2013] [error] server reached MaxClients setting, consider raising the MaxClients setting

As any connection attempts over the MaxClients limit will normally be queued, up to a number based on the ListenBacklog directive this will not be a problem. When one process is freed at the end of a different request, a queued connection will be served.

It only shows as an error because clients are being put in the queue rather than getting served immediately, despite the fact that the user does not see an error response. This error can be allowed to persist to balance available system resources and response time, but sooner or later you will need to increase the RAM on your server so you can start more child processes.