PDA

View Full Version : Diagnose why this is happening:



Chris
01-25-2005, 12:48 PM
2363 root 15 0 3500 2404 2048 S 185.9 0.2 126:57 1 httpd

Apache is sucking down 185.9% of my resources, if that is possible, that is what TOP says. It gets like this every once in awhile the last few days, my solution is to restart it, I can't seem to figure out why though. Traffic isn't that abnormal.

moonshield
01-25-2005, 01:27 PM
how many processes of Apache? I believe you can set the number in the httpd.conf. Maybe you should upgrade to the Apache 2 series. Other than that I would have no clue.

MarkB
01-25-2005, 01:32 PM
Chris, can you tail your access log to see which site/s is/are getting hit hard?

Blue Cat Buxton
01-25-2005, 01:33 PM
even so 186% is impressive!

Xander
01-25-2005, 02:10 PM
That is a crazy figure. I know I had major apache problems with my logs on my last server.

incka
01-25-2005, 03:36 PM
Apache has crashed about 50 times today on my server... I wish there was something more reliable...

For the over 100% all I can think is it's overclocking...

aj8
01-25-2005, 04:05 PM
Apache normally is a reliable daemon. Usually it's a misconfigured module, or a ballooning logfile, or just simply giant load that it hasn't really been configured to handle that kills it.

One of the first things I ask people to look at is what modules they are loaded. Most default Apaches (for example, redhat's) load all kinds of crap that isn't needed; for example WebDAV... Complete waste of memory. I managed to almost half one server's RAM usage by careful disabling of modules. This obviously makes a loaded server much quicker and able to deal with traffic.

A server will not overclock itself when it gets busy! However, you can pile tasks on a machine so high that it's actually being asked to do (and therefore allocating CPU time to) more than it reasonably can.

It's a poor analogy in a lot of ways but, in the same way as a swapfile can make a computer's physical memory appear to be 200% used (i.e. 128MB RAM and 128MB swapfile), so can a decent Operating System task scheduler / multitasking system make a computer appear to be able to deal with more load than it should be able to. In reality nothing gets done any quicker, things are just piled up and done in a sensible order.

Finally I'd mention that the last time I saw an apache go bananas recently was to do with a compromise of a forum CGI script. It was being used to send a heap of spam. Might be worth checking this; it wasn't a root exploit so we just disabled the forum until it could be fixed.

HATH.
A.

Chris
01-25-2005, 04:08 PM
Log files don't show much. I mean, the server hosts my literature site which gets 150k page views a day right now. I did see some attempted buffer overrun things but I patched the PHP when that bug was announced.