SAR vs. TOP for monitoring CPU

Posted on 2006-06-15
Medium Priority
Last Modified: 2008-03-17

We have been monitoring the CPU usage on a system with sar and top.  top seems to give rather spurious results with the CPU idle not apparently relating to the amount of CPU taken up by processes.  See information below - one process is taking up 97% of a CPU, yet the minimum CPU idle is 12%?

Are there anythings to be aware of when reviewing CPU usage using top or sar?  Which is the most accurate?

Many thanks,


System: hwiodsp1                                      Wed Jun 14 10:07:56 2006
Load averages: 0.41, 0.49, 0.40
227 processes: 196 sleeping, 30 running, 1 zombie
Cpu states:
 0    0.32   2.6%   0.0%   0.0%  97.4%   0.0%   0.0%   0.0%   0.0%
 1    0.53  50.2%   0.0%   1.0%  48.8%   0.0%   0.0%   0.0%   0.0%
 2    0.52  87.5%   0.0%   0.8%  11.8%   0.0%   0.0%   0.0%   0.0%
 3    0.26  58.3%   0.0%   0.4%  41.3%   0.0%   0.0%   0.0%   0.0%
---   ----  -----  -----  -----  -----  -----  -----  -----  -----
avg   0.41  49.5%   0.0%   0.6%  49.9%   0.0%   0.0%   0.0%   0.0%
Memory: 2937204K (1391440K) real, 3136700K (1535900K) virtual, 2023896K free  Page# 1/7
 2   ?    17221 oracle   241 20  2241M 19132K run     49:06 96.84 96.67 oracleGIOSPROD
 3   ?    28667 oracle   241 20  2241M 19516K run      2:42 43.52 43.45 oracleGIOSPROD
 0   ?     9591 oracle   154 20  2233M 11372K sleep    0:00  4.82  2.30 oracleGIOSPROD
 0   ?     9467 oracle   154 20  2230M  8932K sleep    0:00  1.39  1.39 oracleGIOSPROD
Question by:neil_mw

Accepted Solution

JJSmith earned 600 total points
ID: 16914493

It's not really a competition, if one was simply better than the other - then we would only have the one!

They WILL demostrate different outputs for the same 'statistic', basically because they measure based on different parameters/algorithms. During their varient calculations, 2 instances ( sar + top ), will not be sampling 'something' concurrently due to natural contention or 'not being in sync' with each other - throw in the fact that the work of one influences the stats of the other and we are almost into chaos theory ;- )

We have to accept they will deliver differences side by side. If I was asked which is the most accurate I would plumb for sar delivering the best 'averages' providing a reasonabley sized interval ( the smaller the interval - the rougher the average ). So it's a good, free, tool for longer term monitoring.

Of course there are 'costed' tools that take all this into account and for a price will provide you with a 3rd set of figures, if run side by side ( sometime they will even discount their own impact of the measured resources ;- )

If we take a 1000th of a second as a clock tick ( really slow these days ), then there are 86,400,000 of them in a day - is the state of the server on one of these ticks really that important?

If we calculate how busy a CPU is and subtracted it from 100 then we would have the idle - but what was it busy doing sys or user, and hang on ..... did it spend any time waiting for I/O ?

If one was simply better than the other - then we would only have the one! - or I have already said that

I don't seek to confuse - but sometimes there are differences .... just because


LVL 62

Expert Comment

ID: 16968448
No system is perfect in such accounting.

uname -a from you will help with system specific interpretaion.

Author Comment

ID: 17558915
No offence to gheist, however I'll accept the lengthy answer by JJSmith.  Sorry for the delay in replying.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

586 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question