Symptoms
Apache takes in requests for the content that you are hosting in your environment and sends that information out to anyone that is requesting it. There is a set number of requests that Apache can handle at one time. When Apache requests are maxed out, new connections cannot be established, resulting in timeout or errors for new connections.
Description
How can you determine if Apache is hitting the max requests it is configured to allow?
It is recommended to start by looking at the Apache error_log to check for any reports for the error. Apache can be quickly checked by running the following search in the command line:
Command: grep MaxRequestWorkers /etc/apache2/logs/error_log
[Fri May 22 11:51:07.896632 2020] [mpm_prefork:error] [pid 9697] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Fri May 22 11:52:15.819243 2020] [mpm_prefork:error] [pid 10331] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Fri May 22 11:57:04.912146 2020] [mpm_prefork:error] [pid 12456] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Fri May 22 13:51:29.874167 2020] [mpm_prefork:error] [pid 7165] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Fri May 22 14:07:57.132146 2020] [mpm_prefork:error] [pid 15544] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
Another way of seeing if Apache is hitting limits is to check the status of apachectl:
Command: apachectl status
At the bottom of the file you will see output similar to this:
CPU Usage: u49.47 s75.88 cu22.34 cs7.6 - .00899% CPU load
.00554 requests/sec - 18 B/second - 3408 B/request - 3.31089 ms/request
1 requests currently being processed, 5 idle workers
__W___..........................................................
................................................................
......................
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process
The less .
you see, the less open slots for Apache you have available. If you see no .
, this means Apache has used all its available slots.
What are Apache's current limits?
You can view Apache's limits in both WHM and the command line.
Command-line: egrep 'MaxRequestWorkers|ServerLimit' /etc/apache2/conf/httpd.conf
egrep 'MaxRequestWorkers|ServerLimit' /etc/apache2/conf/httpd.conf
ServerLimit 256
MaxRequestWorkers 150
WHM: Home » Service Configuration » Apache Configuration » Global Configuration
MaxRequestWorkers can increase up to the value of the ServerLimit that is defined. By default, cPanel installation's ServerLimit is set to 256. If you wish to increment MaxRequestWorkers beyond 256, update the ServerLimit to the new value you need as well.
What is the limit to which I should increase MaxRequestWorkers?
This question is best to be determined by the resources available on your server and your system administrator. Server optimization is typically a task that is meant for a professional system administrator, as one would have the tools and knowledge to adjust this for you. If you have such a system administrator, reach out to them so they can look into this for you. The additional information below should also help with finding the limits of your server resources:
Comments
0 comments
Article is closed for comments.