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
# 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?!