Articles

How to Fix Apache Error 'server reached MaxRequestWorkers setting'

If you see the following message in your Apache error log:

server reached MaxRequestWorkers setting

this does not mean there is anything wrong with Apache or your Apache MaxRequestWorkers setting. You should not make any changes to Apache.

This message means that one of your apps has slow PHP scripts or is receiving such a large number of requests that your PHP scripts aren't able to answer requests as quickly as they are coming in.

Why This Error Happens

PHP can simultaneously execute a limited number of requests for each app. If a PHP script executes very slowly, even a small amount of traffic can cause this limit to be reached. When this limit is reached and all of an app's PHP processes are busy executing requests, each additional request that comes in to your server is queued by Apache until PHP completes an existing request and is available for another. When the number of queued requests waiting for PHP becomes too large, you see this "server reached MaxRequestWorkers setting" error message.

Identifying a Slow PHP Script

In this situation, you should look at your app's PHP slow log located at:

/srv/users/serverpilot/log/APPNAME/APPNAME_phpX.Y.slow.log

where phpX.Y is the version of PHP your app is using, for example php5.6.

This tutorial offers advice on understanding and resolving several different types of slow PHP requests.

Identifying a Large Amount of Traffic to a PHP Script

If you do not see any slow requests, then you should check your app's PHP access log at:

/srv/users/serverpilot/log/APPNAME/APPNAME_phpX.Y.access.log

to see if you are receiving a large number of requests that you do not expect.