I'm running MAMP on OSx as a development machine, and I noticed the past few days that httpd processes sometimes would use a lot of CPU, making the fans run high. The only thing that helps is killing all httpd processes by stopping Apache all together.

I found some resources suggesting that one could lower the number of processes by the following settings in httpd.conf

# MPM Server Pool Settings
StartServers          2
MinSpareServers       2
MaxSpareServers       4

but the problem still persists - the number of httpd processes is fewer, but they still use up all my CPU resources.

I have enabled mod_status, and when I visit a page on my web server that has a missing image, I can see that one of the processes has the URL of the missing image under the Request header. I tried killing this single process using Activity Monitor in OSx, but that only makes another process start looking for the image file instead, so really the only thing that helps is restarting Apache all together.

I've tried waiting for a few minutes to see if they will give up, but they seem to get stuck looking for the missing image file. I know, the obvious answer is Don't have missing image references on your web page., but that is beside the point. Sometimes one simply makes a mistake while editing an image URL, refreshes the page in the browser, and BAM! - Apache is eating up the CPU again!


What's even more confusing is that even after I have created the missing image files and restarted Apache, Apache still seems unable to serve them! If I rename the files to something other than one of the filenames that were missing before I restarted Apache, it can serve the file just fine. It's as if Apache has somehow cached that the file is inaccessible somewhere?!

  • Sorry, but we would need more information such as the contents of your .htaccess virtualhost, error/access logs (only to the file(s) in question). if you changed any settings when installing Apache2 for the first time please include which settings they were and if you are using an install with a reserve proxy, e.g nginx as included with many LAMP/XAMP/VirtualMin etc. Jun 22, 2017 at 13:29
  • 1
    AH! You mentioned .htaccess, and I realized I have a 301 redirect that adds a trailing slash to URL's that don't point to existing files (for routing and canonical purposes). So it seems that's what's happened, I can actually see that there is a trailing slash in the "stuck" URL in mod_status localhost/server-status... should just be a matter of clearing cache in the browser then. Thanks!
    – Magnus
    Jun 22, 2017 at 16:06


Browse other questions tagged or ask your own question.