LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Newbi Sys Admin Under Training - Sar and Top not matching. (https://www.linuxquestions.org/questions/linux-server-73/newbi-sys-admin-under-training-sar-and-top-not-matching-4175568922/)

sumncguy 02-01-2016 07:59 AM

Newbi Sys Admin Under Training - Sar and Top not matching.
 
I guess I dont have a good understand of whats going on.

We have a miss behaving process. I figured Id use this problem as a learning opportunity while the real admins chase it down.

Tops partial output is .. .
Quote:

Tasks: 270 total, 1 running, 269 sleeping, 0 stopped, 0 zombie
Cpu(s): 16.8%us, 1.0%sy, 0.0%ni, 82.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16333096k total, 6872788k used, 9460308k free, 162256k buffers
Swap: 16482300k total, 51260k used, 16431040k free, 1893972k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15134 xxxx 20 0 14.8g 1.6g 14m S 202.7 10.1 410:15.06 bad proccess
19862 xxxx 20 0 15164 1360 920 R 1.7 0.0 0:00.05 top
1 root 20 0 19232 1080 900 S 0.7 0.0 3:00.59 init
31989 root 20 0 684m 5876 2872 S 0.7 0.0 0:21.05 jinga
14995 xxxx 20 0 5720m 796m 5980 S 0.3 5.0 12:26.59 mysqld
15713 xxxxx 20 0 7180m 599m 11m S 0.3 3.8 1:07.68 java
Quote:

-bash-4.1$ sar -u 1 3
Linux 2.6.32-573.3.1.el6.x86_64 (hostname) 02/01/2016 _x86_64_ (12 CPU)

01:52:15 PM CPU %user %nice %system %iowait %steal %idle
01:52:16 PM all 25.35 0.00 3.67 0.08 0.00 70.89
01:52:17 PM all 25.54 0.00 7.20 0.00 0.00 67.25
01:52:18 PM all 25.08 0.00 0.50 0.00 0.00 74.42
Average: all 25.33 0.00 3.79 0.03 0.00 70.86

So my question is .. if top shows the cpu at 200% should I see similar numbers in sar ??

tlowk 02-01-2016 12:05 PM

You can type '1' in top and see different CPU instead of a combine one.

Maybe top show a percentage for 1 core (if you have 4 cores it could show even 400%) when you do not split the cores with the 1 key
and sar might use a percentage relative to the total so it could show 100% instead.

I'm not sure it is entirely correct, but my short experiments suggests something like this.

Emerson 02-01-2016 12:14 PM

Contents removed, misleading.

syg00 02-01-2016 05:33 PM

As suggested, top is non-normalised, so for multi-threaded processes, may report (significantly) above 100.
The duration the average usage is calculated over is also markedly diferent for the two tools.

MrTux 02-02-2016 09:30 PM

I believe it has to do with the multiple cores.


check /proc/cpuinfo instead for accuracy


All times are GMT -5. The time now is 06:27 AM.