It is essential to tune Apache's MaxRequestWorkers setting to mitigate the risk of resource usage problems that could lead to a crash and to ensure that your server can use the resources available to it.
If you see the following in the Apache error log, it is an indicator that you will need to adjust the MaxRequestWorkers setting:
AH00286: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
There are three critical things to keep in mind when evaluating this issue and to adjust the configuration:
- 1. The purpose of MaxRequestWorkers is to limit Apache from using all of the resources on the server.
- 2. Setting the MaxRequestWorkers configuration too low will allow resources that you are paying for to go unused. Ideally, the setting would be set high enough that the server is using a large portion of the available resources but still has enough free resources to maintain stability.
- 3. Setting the MaxRequestWorkers configuration too high will allow Apache to use too many resources during periods of high traffic. Setting the limit too high could allow the server to crash.
cPanel support is not able to provide you with a specific configuration because the required configuration will change base on several variables, including but not limited to:
- 1. The resources available on your server
- 2. The kind of websites on the server
- 3. The specific patterns of traffic that the server must handle
- 4. Any other software that is added to or removed from the server
Due to this, every server that receives any amount of moderate traffic must tune Apache to match the requirements of your specific situation. You must then monitor the server and adjust the tuning if anything changes.
Although cPanel support is not able to tune the server for you, we can provide some guidelines for how to go about doing this.
Usually, the concern is that the server will run low on memory. You can determine if your MaxRequestWorkers configuration will limit Apache's memory usage with the following steps:
- 1. Determine how much memory, on average, your Apache processes use. You can get this by reviewing the RSS column from the following command and divide it by 1024 to convert it to MB:
ps -ylC httpd --sort:rss
- 2. Take the total amount of memory available to the server and subtract the amount of memory that is required for non-Apache processes. The remaining memory is what you will reserve for Apache.
- 3. Take the remaining amount of ram and divide that by the average amount of memory that you expect each Apache process to use.
- 4. The resulting number will be your MaxRequestWorkers value.
NOTE: The MaxRequestWorkers value is limited by the ServerLimit value. You may need to increase the ServerLimit value in order to increase the MaxRequestWorkers value.
You can update the MaxRequestWorkers value in WHM with the following steps:
- Login to WHM as the root user
- Navigate to: Home »Service Configuration »Apache Configuration »Global Configuration
- Update the "Max Request Worker" value
- Click Save
The above process is what the Apache documentation recommends using: