I'm running XAMPP on a OS X testing server... I'm the only person sending requests to the server. I've never messed with Apache config before, so I'm kinda without a paddle here.

When I start Apache, I get ~10 httpd processes started, and 95% idle CPU. When I request a WordPress page, the CPU usage goes to 50%, and the page loads in about five seconds. It seems like once the page has finished loading, the CPU usage jumps to 100%, almost all of that httpd. A ton of processes get started, and they don't go away, and their CPU usage stays the same.

I've changed the MaxRequestPerChild setting and so forth, but nothing seems to solve the problem. Even now, having not send any requests for about 15 minutes, the CPU usage is at 100%.

Here's the applicable settings:

Timeout 10
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 3
<IfModule mpm_prefork_module>
    StartServers       5
    MinSpareServers    0
    MaxSpareServers    2
    MaxClients         20
    MaxRequestsPerChild 50

I had always thought that once the request was made, Apache killed the process. Is there anything I can do to bring down the CPU usage, or is this just something I'll have to deal with?

Thanks for helping out an Apache idiot.

  • What does the Apache logs show? MOst of the time that kind of behaviour is due some redirect problem, like a page requesting for itself requesting for itself requesting for itself requesting for itself (ad infinitum) – Janne Pikkarainen Aug 25 '10 at 8:10
  • I know I sound stupid, but which log? Access log, error log, some other log I don't know about... Thanks. – jdp Aug 25 '10 at 9:59
  • serverfault.com/questions/174038/… – Prix Aug 28 '10 at 5:17

Check your apache log file for redirect loop requests.

If u post your log file snapshot here it will be easy to help..

| improve this answer | |

To answer your question about what happens after a request is processed, Apache keeps a certain number of child processes around at all times. This way Apache can process requests without needing to always fork. The number of child processes and their lifespan is configurable.

Before adjusting the values in the portion of the Apache config you quoted, check to see which Apache MPM (Multi-Processing Module) you are running. Under UNIX/Linux, the two most common are Prefork and Worker. Locate the httpd executable, and run the following command:

./httpd -l

This will list all the modules compiled directly into httpd, including the MPM. The portion of the Apache config you quoted that starts with "" is only active when the Prefork MPM is in use. There is a similar section for the Worker MPM. Try tuning the values in whichever of these sections is applicable to your instillation.

Check the error log for clues, if the issue persists. Good luck.

| improve this answer | |

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.