I have a SAAS product built on php along with apache2 and mysql and it has been hosted on AWS. My production is very very slow on peak times and when I check server-status then it says idle workers are 0 (zero) I am using mpm-prefork

Current Time: Monday, 24-Aug-2020 19:36:32 UTC
Restart Time: Friday, 14-Aug-2020 06:03:27 UTC
Parent Server Config. Generation: 12
Parent Server MPM Generation: 11
Server uptime: 10 days 13 hours 33 minutes 5 seconds
Server load: 1.17 1.07 0.95
Total accesses: 28851443 - Total Traffic: 824.8 GB
CPU Usage: u289.99 s50.68 cu0 cs0 - .0373% CPU load
31.6 requests/sec - 0.9 MB/second - 30.0 kB/request
256 requests currently being processed, 0 idle workers

following is my mpm-prefork.conf setting file

<IfModule mpm_prefork_module>
        StartServers                     5
        MinSpareServers           5
        MaxSpareServers          10
        MaxRequestWorkers         450
        MaxConnectionsPerChild   0

TOP command on ubuntu20.04 gives me this:

top - 20:03:58 up 143 days, 11:16,  1 user,  load average: 0.48, 0.71, 0.83
Tasks: 369 total,   3 running, 317 sleeping,   0 stopped,   0 zombie
%Cpu(s): 15.9 us,  3.2 sy,  0.0 ni, 79.9 id,  0.0 wa,  0.0 hi,  1.0 si,  0.0 st
KiB Mem :  7865072 total,  1023492 free,  2752320 used,  4089260 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  4755856 avail Mem

As per details, I can see 1 GB ram is still free. then wny zero idle workers ? also, why zero idle workers on just 256 requests when I set MaxRequestWorkers to 450. Maximum RAM in machine is 8GB

2 Answers 2


With MPM prefork, if you increase MaxRequestWorkers you also need to raise ServerLimit.

For non-threaded servers (i.e., prefork), MaxRequestWorkers translates into the maximum number of child processes that will be launched to serve requests. The default value is 256; to increase it, you must also raise ServerLimit.


  • Are you sure ? because serverlimit is not mentioned in mpm_fork documentation page. httpd.apache.org/docs/current/mod/prefork.html#maxspareservers
    – Rahul
    Aug 25, 2020 at 12:28
  • Also, could you please give me an idea how to calculate what would be correct number to set serverlimit if I set MaxRequestWorkers = 450
    – Rahul
    Aug 25, 2020 at 12:35
  • Also, the documentaion says There is a hard limit of ServerLimit 20000 compiled into the server (for the prefork MPM 200000). This is intended to avoid nasty effects caused by typos. To increase it even further past this limit, you will need to modify the value of MAX_SERVER_LIMIT in the mpm source file and rebuild the server. Do I really neet to set it as the default limit is compiled in server ?
    – Rahul
    Aug 25, 2020 at 12:37
  • @Rahul The default ServerLimit is 256. The text you quote means that you cannot set it higher than 20000 without recompiling the software. But you should not set it anywhere near that number - set it to the same as MaxRequestWorkers (i.e. 450) unless you have a reason to set it differently.
    – tater
    Aug 25, 2020 at 13:15
  • Thanks a lot for all information and for your support. Love live Humanity. God bless you !!
    – Rahul
    Aug 25, 2020 at 14:26

With mpm_prefork, the webserver spawns new processes to handle requests. Each process is only able to handle one request at a time.

In your example, your webserver is set up to have at minimum 5 idle server processes waiting to handle requests and at most 10. Given that you're handling over 250 simultaneous requests, it may be that your webserver is unable to spawn new processes quickly enough.

I'd increase the StartServers, MinSpareServers and MaxSpareServers values to ensure that you have plenty of available capacity for load spikes or heavy loads.

You might also want to consider changing to another Multi Processing Module depending on the type of workload you need to serve.

Edit: @tetech's answer is the correct one, however you may also wish to consider tweaking these values as this could improve webserver performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.