Articles in this section

How to calculate and adjust the MaxRequestWorkers limit on the server with Plesk

kb: how-to Plesk for Linux kb: technical apache

Question

  • How to calculate and configure the MaxRequestWorkers limit on the server with Plesk

Answer

Note: The below values are examples. They must be adjusted according to the server capabilities and load. Increasing the limit MaxRequestWorkers should only be done after a full investigation of the server.

The general formula for making the necessary calculation is the following: 

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

  • MPM Event: The default ServerLimit value is 16. To increase it, you must also raise MaxRequestWorkers using the following formula: ServerLimit value x 25 = MaxRequestWorkers value. For example, if ServerLimit is set to 20, then MaxRequestWorkers will be 20 x 25 = 500.
  • MPM Prefork: The default MaxRequestWorkers value is 256. To increase it, you must also raise ServerLimit.
For a RHEL-based operating system
  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:

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

    • For MPM Prefork:

      CONFIG_TEXT: <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:

    # systemctl restart httpd

For a Debian-based operating system
  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):

      CONFIG_TEXT: 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):

      CONFIG_TEXT: MaxRequestWorkers 400
      ServerLimit 400

  3. Save the changes and close the file.
  4. Restart Apache to apply the changes:

    # systemctl restart apache2

Note: If the issue persists, the recommendation is to make sure you are using the Prefork MPM mode at Tools & Settings > Apache Web Server, since it provides better overall stability for Apache processes.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.