Ec2 Ubuntu server running apache and php. Mobile application is hosted on server. App connects to server on 80 port. Issue is apache limits to 150 process on peak hours. Cpu is almost 100% idle when apache has 150 process. Increased max clients to 500 on Prefork mpm. But it's still limiting to 150 process. Ps aux and newrelic shows apache process limiting at 150 process.

  • Check to be 100% you are using prefork with apachectl -V (if you haven't already). Search for any of the mpm directives listed here httpd.apache.org/docs/2.2/mod/mpm_common.html (some depend on the MPM). And if you enable the /server-info handler you will be able to actually see the current running configuration. Add the info to your post. – Unbeliever Oct 15 '16 at 15:03

Issue was MaxRequestWorkers was 150 on /etc/apache2/mods-enabled/mpm_prefork.conf its not changing after increasing value on apache conf. Now changed to

<IfModule mpm_prefork_module>
          StartServers                     5
          MinSpareServers           5
          MaxSpareServers          10
          ServerLimit               1200
          MaxRequestWorkers         1200
          MaxConnectionsPerChild    1000 

-on /etc/apache2/mods-enabled/mpm_prefork.conf and now apache getting more hits.

  • Had the same issue, increasing the value in apache2.conf didn't work because the line loading the module configurations Include /etc/apache2/mods-enabled/*.conf was after the <IfModule mpm_prefork_module> conditional. – AlexT Sep 21 '17 at 7:36

Probably the ServerLimit variable. It's often not yet in the default config file, so you'll have to add it. Restart Apache to have it take effect (reload doesn't work).

I usually make a block like this:

<IfModule mpm_prefork_module>
    StartServers          150
    MinSpareServers       150
    MaxSpareServers       150
    MaxClients            150
    Serverlimit           150
    MaxRequestsPerChild   10000

This disables worker creation/destruction, to which I see no point.

  • Do I need to increase MaxClients? Now its 500 and apache process still limits at 150 not going further and users get timeout message – adminz Oct 15 '16 at 15:46

Read the Apache documentation for the MPM module. It appears you need to increase the MaxRequestServers value.

The page also has a link to performance tuning documentation.

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.