![如何理解 top 命令的输出](https://linux22.com/image/664225/%E5%A6%82%E4%BD%95%E7%90%86%E8%A7%A3%20top%20%E5%91%BD%E4%BB%A4%E7%9A%84%E8%BE%93%E5%87%BA.png)
如何理解 top 的输出,因为平均负载不断增加,但无法理解哪个进程正在消耗 CPU,因为进程的 %cpu 利用率最大为 0.7,但平均负载显示的值很高!那么如何知道瓶颈在哪里呢?
#top
top - 06:47:14 up 302 days, 21:14, 5 users, load average: 151.51, 142.09, 116.27
Tasks: 570 total, 1 running, 568 sleeping, 0 stopped, 1 zombie
%Cpu(s): 0.5 us, 0.5 sy, 0.0 ni, 0.0 id, 99.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 3838696 total, 3221216 used, 617480 free, 67004 buffers
KiB Swap: 0 total, 0 used, 0 free. 349404 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7188 mysql 20 0 1794140 266584 1084 S 0.7 6.9 511:44.15 mysqld
7591 ubuntu 20 0 23964 2008 1176 R 0.7 0.1 0:08.87 top
10983 root 20 0 277124 20132 1252 S 0.7 0.5 634:22.01 php
3382 root 20 0 282768 22020 1828 S 0.3 0.6 126:43.32 php
8570 root 20 0 17872 180 0 S 0.3 0.0 172:52.24 wrapper
8572 root 20 0 1958428 479468 304 S 0.3 12.5 538:40.04 java
11043 root 20 0 277116 20020 1232 S 0.3 0.5 361:08.73 php
1 root 20 0 37344 5944 760 S 0.0 0.2 11:53.34 init
2 root 20 0 0 0 0 S 0.0 0.0 0:06.09 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:18.23 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 46:22.19 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 38:55.10 rcuos/0
答案1
如果你能看到 top 的输出,你会发现只有 1 个进程在运行,1 个处于僵尸状态,568 个处于休眠状态,似乎有一个 Java 进程可能是造成负载的罪魁祸首,请检查 pmap