Plesk

Apache web server goes down intermittently with the following error: server reached MaxRequestWorkers setting, consider raising it

Symptoms

[mpm_event:error] [pid 44099:tid 140542724503680] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

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

  1. Connect to the server via SSH.

  2. 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

  1. 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.

  2. 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.

Exit mobile version