Why are processes increasing continuously on the apache web server

apache-2.2process

I am running an apache 2 webserver. Everything works fine, but about every 14-20 days i have to restart the web server because it does not respond anymore.

Looking at the munin statistics, i recognized, that it is related to the number of apache processes. They are increasing continuously until they reach 150. Then Apache does not respond.

How do i prevent "freezing" apache?

Here is screenshot of the statistics:

increasing processes in an apache 2 web server

Details:

  • Apache runs on a Debian 5.0 root server.
  • Using ISPConfig for management
  • I host about 30 Websites
  • 1000 Page Impressions per day (sum of all websites)
  • Most of them are Drupal installations
  • One Piwik Installation for all sites
  • Some custom PHP applications

Logs ans Status messages:

Extended apache status shows 30 of 45 of these lines (replaced real hostname by SERVERNAME):

22-5    -   0/0/75  .   0.00    1813    0   0.0 0.00    1.17    ::1 SERVERNAME  OPTIONS * HTTP/1.0

Some Apache Settings (Default settings):

  • prefork module is enabled
  • MaxKeepAliveRequests = 100
  • Timeout = 300
  • KeepAlive = On
  • KeepAliveTimeout = 15
  • MaxClients = 150
  • MaxRequestsPerChild = 0
  • StartServers = 5
  • MinSpareServers = 5
  • MaxSpareServers = 10
  • MaxClients =150
  • MaxRequestsPerChild = 0

Best Answer

This looks like you have some requests that never terminate, forcing Apache to spawn new processes until the configured maximum is reached. After that, Apache has no option to create new processes for new requests and appears dead.

It's impossible to tell what might cause this with the few data you give us.

Do you see any hints in the log files? What kind of pages to you serve to the clients? Static HTML, PHP, CGI or something else? On what OS?