Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This is my top output print. enter image description here

Basically my site hangs on and the server needs to be restarted once at 4-5 hours...I supposed that mysql is the issue so I disabled some hard queries but I still see problems on apache...

Is there a way to find out why my apache process is eating so much cpu?

share|improve this question

2 Answers 2

Try using and/or looking into the server logs and see what script is executing. I'm assuming its a script that entered an infine loop somehow

share|improve this answer
+1. Mod status is really helpful to debug this kind of issues. –  pehrs Feb 28 '11 at 11:52
A broken script (infinite loop, server fault, memory leak, etc.) is the most likely suspect, but I don't think mod_status will show any detail on which script it actually is. One might try "top -c" to show files in top, but you often don't get any detail there either. The apache error log might be helpful. This is an area where apache is really hard to troubleshoot -- it would be nice to have a tool that shows what file the apache process is serving; "apachetop" looks promising, but I have never tried it. –  bogeymin Feb 28 '11 at 11:54
this is how sgould look like. You can see the requests in there –  quamis Feb 28 '11 at 12:11

You've not said whether this running pre-fork or threaded. Nor what's running in process - e.g. php.

You could try grabbing a core file and looking at the stack trace in gdb, or logging %D and looking for what takes a long time to complete might give a bit of a clue - but if you provide more information about what you've got set up it might help.

The fact the apache instance hogging all the CPU is also using up a LOT of memory points to poorly written code. Taking a wild stab in the dark - it might be a badly written query with an in-process language reading in too much data.

share|improve this answer

Your Answer


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.