Raise apache 2.0 max clients hard limit in cpanel

Apache 2.0 makes raising the max client from the default 256 hard limit a little harder now. If you have cpanel then it’s even a little harder or I should you just need to know what to do, figuring it out is a shot in the dark.

One main difference is you have raise the server limit if you want to raise the max client limit.

The easiest way to do this is to go to:

  1. Web Hosting Manager
  2. Then click Apache Configuration
  3. Then click Include Editor
  4. Then click the apache version under the pre-main include
  5. Then add this to the input section:

ServerLimit 512

StartServers 32
MinSpareServers 5
MaxSpareServers 20
MaxClients 512
MaxRequestsPerChild 1000

Then save and it will ask to restart apache you click yes there.

Now your apache limit is set to 512 and cpanel will not mess with it.

Here is the explanation for each derivative in the above code:

MaxClients:

The MaxClients sets the limit on maximum simultaneous requests that can be supported by the server; no more than this number of child processes are spawned. It shouldn’t be set too low; otherwise, an ever-increasing number of connections are deferred to the queue and eventually time-out while the server resources are left unused. Setting this too high, on the other hand, will cause the server to start swapping which will cause the response time to degrade drastically. The appropriate value for MaxClients can be calculated as:

If there are more concurrent users than MaxClients, the requests will be queued up to a number based on ListenBacklog directive. Increase ServerLimit to set MaxClients above 256.

MinSpareServers, MaxSpareServers, and StartServers:

MaxSpareServers and MinSpareServers determine how many child processes to keep active while waiting for requests. If the MinSpareServers is too low and a bunch of requests come in, Apache will have to spawn additional child processes to serve the requests. Creating child processes is relatively expensive. If the server is busy creating child processes, it won’t be able to serve the client requests immediately. MaxSpareServers shouldn’t be set too high: too many child processes will consume resources unnecessarily.

Tune MinSpareServers and MaxSpareServers so that Apache need not spawn more than 4 child processes per second (Apache can spawn a maximum of 32 child processes per second). When more than 4 children are spawned per second, a message will be logged in the ErrorLog.

The StartServers directive sets the number of child server processes created on startup. Apache will continue creating child processes until the MinSpareServers setting is reached. This doesn’t have much effect on performance if the server isn’t restarted frequently. If there are lot of requests and Apache is restarted frequently, set this to a relatively high value.

MaxRequestsPerChild:

The MaxRequestsPerChild directive sets the limit on the number of requests that an individual child server process will handle. After MaxRequestsPerChild requests, the child process will die. It’s set to 0 by default, the child process will never expire. It is appropriate to set this to a value of few thousands. This can help prevent memory leakage, since the process dies after serving a certain number of requests. Don’t set this too low, since creating new processes does have overhead.