In my CentOS server, when I check the resources with sar command, user cpu usage is around %15 while in top command the sole 'java' process uses like %99 of cpu. sometimes it's even goes further than %100! who's lying here?

link|improve this question

40% accept rate
feedback

1 Answer

up vote 2 down vote accepted

Neither -- they're just giving a different idea of CPU usage.

Top's idea of CPU is "per-core" -- that is, "this program is using 100% of one core". A multithreaded program can, therefore, be using, say, "400% CPU" -- which makes the eyes water a little sometimes.

On the other hand, sar sees it as as a percentage of total CPU -- so on a 4 core system, one fully utilised CPU core will show as "25% CPU", and the 400%-using program will show as 100%.

There's also the issue of instantaneous vs long-term averages, but I'm going to assume that you've accounted for that.

link|improve this answer
Thanks for the answer buddy, that was my guess too. I actually have considered long-term averages and the interval was set to 1 sec. – SJ.Jafari Aug 15 '11 at 15:23
feedback

Your Answer

 
or
required, but never shown

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