Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In one of our production Linux servers, CPU utilization is crossing 100 % and sometimes it is 250%.

How can I find which process is using more CPU utilization and where can I find CPU utilization logs?

OS : RHEL 5.5

share|improve this question

migrated from Jan 4 '12 at 7:28

This question came from our site for professional and enthusiast programmers.

CPU utilization is measured relative to a single CPU. The maximum is 100% for each CPU, so a four-CPU system would have a maximum CPU utilization of 400%.

share|improve this answer

Try using the top command

man top for more info

share|improve this answer

The sar utility collects some statistics about your system if it is switched on. The simplest way to access them is to type sar on the command line.

A far better option is to install a monitoring system such as Cacti, Munin or Zabbix. (Although Nagios can do graphing, this is not its forte.) There are plenty of questions on ServerFault already about which monitoring system is the best. Once you install one of them, you will have trouble remembering how you lived without it.

Generally, these will not tell you which process was using all the CPU at any given time. For that, top or htop at the time is your best bet. Bear in mind that 25 Apache processes using 10% CPU each shows up differently in top to a single MySQL process using 250% CPU.

The other key metric to watch is the "load average". This is an indication of how many processes are currently waiting to get on a processor. This is a very good indicator of how slow your system will feel to use.

Another note on CPU utilisation, virtual machines can dynamically alter the CPU capacity in response to the needs of the VM. I have seen a single process showing up as using 9999% CPU in top from within a VM. The advice given by VMWare about this is "Don't trust metrics measured from within the VM".

share|improve this answer

Another option is to use the ps command and sort on CPU usage:

ps aux --sort=+cpu
share|improve this answer

There is no logging of process utilization, you might want to install something like atop for this. There used to be a GNU "system accounting" package, too, but IIRC it's less suitable.

share|improve this answer

Not sure what you use to measure the utilization but you can use:

cat /proc/loadavg 
share|improve this answer

Others have mentioned top.

If you want, you can run top -b -n1 | head in batch mode in cron and save the output somewhere, to keep track of top processes.

share|improve this answer

I have answered a similar question to this. You may want to enhance that script for your own needs. Basically, the command ps -eo pcpu,pid,user,args | sort -k 1 -r | head -n 5 will give you some meaningful output. You may just want to automate it and log the output for later analysis.

share|improve this answer

protected by Community Sep 7 '15 at 8:09

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?