Symptoms
- The Apache web server goes down periodically with the following error in the error log (
/var/log/httpd/error_log
for RedHat-based distributions,/var/log/apache2/error.log
for Debian-based distributions):
[mpm_event:error] [pid 44099:tid 140542724503680] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
- MaxRequestWorkers value was increased several times according to the next KB article
Cause
The MaxRequestWorkers
limit has been reached due to a DDoS attack or the response time of the task is very long.
Resolution
Check if the server is under a DDoS attack
-
Connect to the server via SSH.
-
Check if the server is under a DDoS attack:
-
Make sure that there are a lot of connections and specific IP addresses. This command shows the source IP addresses and numbers of the connections:
# netstat -an | egrep ':80|:443' | grep ESTABLISHED | awk '{print $5}' | grep -o -E "([0-9]{1,3}[.]){3}[0-9]{1,3}" | sort -n | uniq -c | sort -nr
299 203.0.113.2
118 203.0.113.5
8 199.1.103.2
And find the domains under attack via the command:
# grep `203.0.113.2` /var/www/vhosts/system/*/logs/access_log
-
Adjust Fail2ban/Firewall settings and configuration. Disable the affected domain for some time.
-
Check if there are long-time requests
-
The other reason why the number of worker processes can increase is how long it takes to process requests. Monitor Apache webserver performance using mod_status module. Enable mod_status using the steps below:
-
create
11-mod_status.conf
file with the following content:For Debian-based OS:
# touch /etc/apache2/conf-enabled/11-mod_status.conf
# cat /etc/apache2/conf-enabled/11-mod_status.conf
<Location "/server-status">
SetHandler server-status
Require all granted
</Location># service apache2 reload
For RHEL-based OS:
# touch /etc/httpd/conf.modules.d/11-mod_status.conf
# cat /etc/httpd/conf.modules.d/11-mod_status.conf
<Location "/server-status">
SetHandler server-status
Require all granted
</Location># service httpd reload
-
Access server statistics by using a Web browser with the URL
http://your.server.name/server-status
Check SS, Req fields and check what websites and pages have higher values. If it requires a significant time to process
.php
script, the code of this script should be reviewed. -
-
If there are any websites with high traffic load, switching to serve the website only by Nginx web server allows decreasing load on Apache. Disable the "Proxy mode" option in Websites & Domains/Domains > Domain name > Apache & nginx Settings.