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 have server with approximately 500 active connections at a time (it's for a very busy website). Unfortunately, Apache keeps crashing the entire server every hour or so. The server has 8 GB of RAM and a quad core Xeon CPU so, as far as I am concerned, this should be sufficient to handle the amount of connections. I suspect that my Apache configuration could need some optimization. Here is the current config:

StartServers          2
MinSpareThreads      25
MaxSpareThreads      75 
ThreadLimit          64
ThreadsPerChild      25
MaxClients           400
MaxRequestsPerChild  20000

Any advice (not only related to Apache) is MUCH appreciated!

share|improve this question
    
If you're running around 500 connections, you're probably hitting your MaxClients 400 configuration. What's the behavior of the Apache server when the crash occurs? HTTP errors to clients, or "connection refused"? Anything in Apache's error log? –  Shane Madden Mar 15 '12 at 17:31
    
Did you already remove the unused modules? –  ghm1014 Mar 15 '12 at 22:09
    
Your other possibility is DoS attacks, have you implemented defence against the PHP hash table collisions? and SlowLoris Apache connection blocking? –  Oneiroi Mar 16 '12 at 9:30
add comment

4 Answers 4

Is your machine crashing or the Apache server?

If the first, then I would consider it might be faulty hardware (memory).

If it's the second, try to use some monitoring tools like munin to see what happens at what time intervals and what the load/stress on your server is. Also check your error logs to get more clues what's happening.

share|improve this answer
add comment

Nothing in your configuration should ever cause Apache to crash. Unless you are running out of memory, you should look somewhere else for the cause of the problem.

share|improve this answer
add comment

you should start by graphing the utilization of your ressources (eg load, memory, swap..) so you get a picture of what's actually happening.

Take a look at the system and apache logs and see if there are some "abnormal" messages right before the crash.

From your config excerpt i guess you are using the worker mpm, it looks rather normal, this config alone will not lead to a crash on it's own.

share|improve this answer
add comment

Are you running any scripting language, PHP maybe?

Background of my question is that I had something similar on one server running Apache and PHP. At the end of the day it hasn't been Apache killing the server, but PHP running into OOM killing virtually vital processes and THAT killed the server (for me).

Check my answer in this thread for a OOM workaround. Maybe check your server log files for OOM entries as well.

share|improve this answer
add comment

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.