5 Answers
5

Perhaps you've got a relatively small MaxClients, keepalives on with a long-ish timeout, and quite a lot of requests.

Browsers will generally hold a connection open for 30 seconds or so if you let them - so don't set keepalive too long.

Having keepalive on for a short period is beneficial to your users - but it does use up resources. Are you able to see the Apache scoreboard (i.e. server-status page?) ? Are all your slots consumed in 'K' state?

In general mixing application serving (your PHP app) and high-volume static files is a bad idea, they have different requirements. A fat Apache process (like ones with PHP in) is going to be wasting lots of memory serving static images that could be served by a thin one instead. Consider putting them in separate sets of physical servers, or on separate server instances on the same set of servers (with very different configs)

Apache's MaxClients is a big one. You can view what the current client/connection count is by enabling mod_status and running "apachectl status" or loading "http://localhost/server-status" in a web browser from the web server

Depending on the scale of your static image serving, you might look into running something like lighttpd along side it to serve images. It tends to do much better with just static images. Lighttpd (lighty) is just that, light and will serve static content much more quickly and tuned a bit will likely not run into these limitations. The same could be done with Apache, but Apache is a bit hefty for just static content.