Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
Which application you run on Apache? What does httpd.conf look like? Did you take a look at extended status page? –  quanta Sep 5 '11 at 8:52

2 Answers 2

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?

share|improve this answer
    
I added some details. What should i look for in the log files? –  Martin Schlagnitweit Sep 5 '11 at 8:52

You should certainly not be seeing this kind of behaviour - it implies something is very broken in your system.

What are your settings for:

Timeout
KeepAlive
MaxKeepAliveRequests
KeepAliveTimeout
MaxRequestsPerChild
ServerLimit
MaxClients

?

Is this pre-fork or threaded apache?

However it's much more likely that the problems are arising elsewhere. Does apache use any scripting/app engine? If so what? How is it configured?

share|improve this answer
    
i updated my question –  Martin Schlagnitweit Sep 5 '11 at 18:32
    
Your config is far from optimal - try StartServers 20, MinSpareServers 15, KeepAliveTimout 3, MaxRequestsPerChild 250 (this last value is deliberately on the low side given your current problems). MaxClients looks to be a little low if this is a dedicated machine - but the right value depends on memory usage. But as above, it sounds like the problems are in the PHP code - is this mod_php, fastCGI, CGI? Any ignore_user_abort() in your code? –  symcbean Sep 6 '11 at 8:59
    
Mostly Fast-CGI, some CGI and one SuPHP. some ignore_user_abort() in cron files. –  Martin Schlagnitweit Sep 7 '11 at 16:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.