Symptoms
The websites on the server slow down significantly, or begin to give random timeout errors. Checking the Apache error log, it is observed the following error is being logged:
CONFIG_TEXT: AH00286: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
Cause
Apache sets a limit for the number of workers that are available for all websites on the server to prevent the server from becoming overloaded. If this limit is reached, new connections are "queued" until a worker becomes available. This can cause delays when attempting to access websites hosted on the server, or a timeout if no worker becomes available. Tuning Apache's MaxRequestWorkers setting for your needs and server's resource allocation is essential to mitigate the risk of resource usage problems that could lead to a crash, while ensuring that your websites can use the resources that are needed.
Note: cPanel support cannot provide specific configuration guidance as the required configuration will change based on several variables; including the resource allocation of the server, the amount of traffic, the number of hosted websites, the resource requirements of each website, and more.
Warning: Setting the MaxRequestWorkers configuration too high could allow Apache to use too many resources during periods of high traffic, which may result in services crashing if the server's resources are exhausted. Ideally, the setting should be set high enough that the server uses a large portion of the available resources, while still having enough free resources to maintain stability.
Resolution
- Access the server's command line as the 'root' user via SSH or in WHM at: Home / Terminal
-
Run the following command to view how much memory each Apache process is currently using in MB.
# ps -ylC httpd --sort:rss | awk 'NR!=1 {print $8 / 1024}'
- Estimate the expected average memory usage for an Apache process based on the above output.
-
Run the following command to find the available memory in MB.
# free -m | awk 'NR==2 {print $7}'
-
Divide the available memory by the expected average memory usage for an Apache process to determine the
MaxRequestWorkersvalue.CONFIG_TEXT: MaxRequestWorkers = Usable memory / Expected average process size
- Log in to WHM as the root user.
- Navigate to: Home / Service Configuration / Apache Configuration / Global Configuration
- Scroll down to the Server Limit option.
- Enter a value higher than the
MaxRequestWorkersvalue in the Server Limit textbox. - Enter the desired
MaxRequestWorkersvalue in the Max Request Worker textbox. - Click the Save button.
- Click the Rebuild Configuration and Restart Apache button.
Additional resources
Apache's Documentation: Hardware and Operating System Issues
Comments
0 comments
Article is closed for comments.