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
MaxRequestWorkersusing the following formula: ServerLimit value x 25 =MaxRequestWorkersvalue. For example, ifServerLimitis set to 20, thenMaxRequestWorkerswill be 20 x 25 = 500. -
MPM Prefork: The default
MaxRequestWorkersvalue is 256. To increase it, you must also raiseServerLimit.
-
Find which Multi-Processing Module (MPM) is currently in use:
# httpd -V | grep MPM
- Open the
/etc/httpd/conf.modules.d/01-cgi.conffile 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>
-
- Save the changes and close the file.
-
Restart Apache to apply the changes:
# systemctl restart httpd
-
Find which Multi-Processing Module (MPM) is currently in use:
# apache2ctl -V | grep MPM
- Change the MPM configuration:
-
For MPM Event:
Open the
/etc/apache2/mods-enabled/mpm_event.confin 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.conffile 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
-
- Save the changes and close the file.
-
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.
Comments
Please sign in to leave a comment.