Applicable to:
- Plesk for Linux
Symptoms
Apache web server goes down periodically with the following error message in its error log:
-
on CentOS/RHEL-based distributions:
/var/log/httpd/error_log
-
on Debian/Ubuntu-based distributions:
/var/log/apache2/error.log
CONFIG_TEXT: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
Cause
The MaxRequestWorkers
limit 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.
Resolution
Adjust the MaxRequestWorkers
settings for Apache. General formula looks like below:
# 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, ifServerLimit
is set to 20, thenMaxRequestWorkers
will be 20 x 25 = 500. -
MPM Prefork: The default
MaxRequestWorkers
value is 256. To increase it, you must also raiseServerLimit
.
Note: The below values are examples. They must be adjusted according to the server capabilities and load.
-
Find which Multi-Processing Module (MPM) is currently in use:
# httpd -V | grep MPM
-
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>
-
-
Save the changes and close the file.
-
Restart Apache to apply the changes:
# service httpd restart
-
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.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
-
-
Save the changes and close the file.
-
Restart Apache to apply the changes:
# service apache2 restart
Note: if the issue persists, switch MPM to Prefork in Tools & Settings > Apache Web Server.
Comments
13 comments
I am tired of plesk, i inscreased this and it is still happening
Still having the same issue on two servers despite raising
MaxRequestWorkers
to 1000@Dan, Am I right that even after changing 'MaxRequestWorkers' to 1000 and restarting apache you still see 'server reached MaxRequestWorkers setting' errors in apache logs? Additionally, you may check this article which contains troubleshooting steps.
for mpm_event where i can change MaxRequestWorkers value?
@Luis, the path is almost the same:
Debian/Ubuntu /etc/apache2/mods-enabled/mpm_event.conf
CentOS the same file but <IfModule mpm_event_module> section.
This issue continues to be a problem, despite having these settings already (which I just verified following the instructions above). Everything has been working fine on my server for past few months since I fixed some problems after a previous Plesk update. Lo and behold, Plesk autoinstaller updated last night around 3am and I have been dealing with this problem since I got up. Frustrating that Plesk updates keep causing problems.
@Ryan Yzquierdo,
If you still experience any issues after the update, don't hesitate to contact our Support Team so they can thoroughly check the issue.
I got the same error.
To ward off url attacks, I wrote in php in case of evil Url
sleep(99999);
exit;
I dropped sleep and changed it into
exit;
That was my problem. Now I get no maxRequestErro error any more.
Hello Björn Goldecker
Thank you for sharing your user experience.
I just checked my CentOS Apache 2.4, using Event MPM but cannot found "MaxRequestWorkers" and "ServerLimit", should I need to manually add it? Or by default it won't show anything in the /etc/httpd/conf.modules.d/01-cgi.conf ?
Hello @Simon Liu
In case "MaxRequestWorkers" and "ServerLimit" are missing in the file, these parameters should be added.
Thanks Alexey.
I had similar issue which kept coming back.
I switched from mpm_event to mpm_prefork and it seems it is gone.
Please sign in to leave a comment.