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.

Our production web server has gone down a few times over the course of the last half year. In the end, we've needed to contact the web host and have them restart as I'm unable to even SSH in. This appears to only affect the web server and not the MySQL database server which is separate. When it affects the web server, all hosted websites time out.

I'd like to examine web server optimization/corrections to get to the root of this issue. Any recommendations on how to proceed with that? I'm sure log files would play a role. I'm able to find my way around a Linux-based server and make needed changes, but would be interested in any tips I may not have thought of yet. It may be best for us to speak with an outside consultant as another option.

Thanks.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

This sounds like a classic case of swapping. If you have any metrics/monitoring system at all available check the memory reports (sar, cacti, munin, etc). If not, time to pick one and set it up.

Odds are its the simple case of (number of apache children) x (average memory size of an apache child) > available memory. You can attack this in several ways, first see if you can trim down your php scripts. Don't go nuts, but if there's some simple include/require/classloader fixes you can make you might be able to chop their footprint in half with a quick afternoons worth of profiling work. After that, whatever your average apache child size is do the math to figure out how much would fill up all available ram, then back off ~20% and make that your MaxClients setting.

share|improve this answer
    
You've given me a lot to think about. Thanks. I'll have to do some research in this area. Accepting this as it'll give me a concrete starting point. –  MattB Feb 23 '11 at 22:53

How about having more than one webserver, and balance the load between them, so if one fails, then you could nominate the backup to take over.. I'd say that having such a large single point of failure should be one of the first places to start looking.

share|improve this answer
    
A good proposal. I'm not sure if we're ready for that yet though until we get the periodic downtime resolved with the current issue. –  MattB Feb 23 '11 at 22:54

RPM (resource protection monitor) from RFX would work wonders for you.

In short - (its free) what this does is - it looks and when it sees a system process is using to many processes it will restart or down that process hold it and then restart.

Really nice :-)

Saves most of the webhosts out there much of the time

share|improve this answer
1  
Did you mean "Process Resource Monitor" from R-FX Networks, rfxn.com/projects/process-resource-monitor ? :-) –  Jesper Mortensen Feb 11 '11 at 1:01
    
yes - sorry - was working very late ... –  Glenn Kelley Feb 13 '11 at 10:57
    
Thanks. We'll check into this. Our host may also have tools they can help put in place. –  MattB Feb 23 '11 at 22:52

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.