Plesk

Apache keeps going down on a Plesk server: server reached MaxRequestWorkers setting

Symptoms

Cause

The MaxRequestWorkers limit set for the Apache web server has been reached and there are no free workers to serve new requests to Apache. As a result, requests are being served slowly or not served at all and therefore the websites become inaccessible, even though the server's CPU and RAM resources are not exhausted.

Resolution

Adjust the MaxRequestWorkers settings for Apache. The general formula for making the necessary calculation is the following: 

# MaxRequestWorkers = (Total RAM - Memory used for Linux, DB, etc.) / average Apache process size

Note: The below values are examples. They must be adjusted according to the server capabilities and load.

For CentOS/RHEL-based distribution

 

  1. Find which Multi-Processing Module (MPM) is currently in use:

    # httpd -V | grep MPM

  2. Open the /etc/httpd/conf.modules.d/01-cgi.conf file in a text editor (for example, vi editor) and increase the values of the following directives (or add them if they are not present in the file):

    • For MPM Event:

      <IfModule mpm_event_module>
      LoadModule cgid_module modules/mod_cgid.so
      MaxRequestWorkers 400
      ServerLimit 16
      </IfModule>

    • For MPM Prefork:

      <IfModule mpm_prefork_module>
      LoadModule cgi_module modules/mod_cgi.so
      MaxRequestWorkers 400
      ServerLimit 400
      </IfModule>

  3. Save the changes and close the file.

  4. Restart Apache to apply the changes:

    # service httpd restart

 

For Debian/Ubuntu-based distributions

 

  1. Find which Multi-Processing Module (MPM) is currently in use:

    # apache2ctl -V | grep MPM

  2. Change the MPM configuration:

    • For MPM Event:

      Open the /etc/apache2/mods-enabled/mpm_event.conf in a text editor (for example, vi editor) and increase the values of the following directives (or add them if they are not present in the file):

      MaxRequestWorkers 400
      ServerLimit 16

    • For MPM Prefork:

      Open the /etc/apache2/mods-enabled/mpm_prefork.conf file in a text editor (for example, vi editor) and increase the values of the following directives (or add them if they are not present in the file):

      MaxRequestWorkers 400
      ServerLimit 400

  3. Save the changes and close the file.

  4. Restart Apache to apply the changes:

    # service…