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'm trying to find the bottlenecks and I'm currently logging the time in the script but it seems to be random times for certain operations. Is there a tool that will allow me to see the breakdown of what's going on during a certain [apache] request to track down if the CPU is just burning the whole time or if it's waiting for something else?

share|improve this question

closed as too broad by kce, mdpc, Avery Payne, Wesley, Jenny D Apr 26 at 6:04

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Missed a tiny detail...what operating system? –  Chopper3 Nov 24 '09 at 14:14
add comment

4 Answers

This is a question of profiling; you need to hook up a profiling tool to the process and get it what's really going on. For really poor-man's profiling, I just attach to it using strace; using the timing flags (-T -r) usually gives me a good idea of what system calls are taking the time, and whether the process itself is just grinding along. There are better things out there, but they're more developer-oriented.

share|improve this answer
add comment

If you're using a windows OS, then the free tools from SysInternals might be the best place to start. The Process Explorer tool is pretty good at watching the active processes, what's calling them, and what actions are taking place. SysInternals makes it pretty easy to download the SysInternals Suite of tools. It's kinda like an American Express Card, don't leave home with it.

Hope this helps some.

share|improve this answer
add comment

Something else to check, If you're able, is to monitor the server's performance.

Maybe your disk queues are spiking, maybe you have a failing drive in the RAID, maybe you are running out of memory, etc...

share|improve this answer
add comment

You can see some more detail with a tool like procstat. You feed it a PID and it decodes the /proc/$pid/stat file which can tell you some interesting internals stuff, like number of CPU jiffies it has used, or its children have used.

share|improve this answer
add comment

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