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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

649 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