linux平均负载分析

终端运行 mpstat 查看 CPU 使用率的变化情况:

#显示所有CPU的指标,并在间隔5秒输出一组数据
[root@test001 ~]# mpstat -P ALL 5
Linux 3.10.0-1127.8.2.el7.x86_64 (test001) 	03/15/2021 	_x86_64_	(2 CPU)

02:55:34 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
02:55:40 PM  all    1.21    0.00   95.65    0.10    0.00    0.20    1.11    0.00    0.00    1.72
02:55:40 PM    0    1.20    0.00   97.79    0.00    0.00    0.20    0.20    0.00    0.00    0.60
02:55:40 PM    1    1.02    0.00   94.06    0.00    0.00    0.20    1.84    0.00    0.00    2.87

用 pidstat 来查询具体的进程或者操作命令:

[root@test001 ~]# pidstat  -u 6 1
Linux 3.10.0-1127.8.2.el7.x86_64 (test001) 	03/15/2021 	_x86_64_	(2 CPU)

02:54:18 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
02:54:24 PM     0         7    0.00    1.49    0.00    1.49     0  migration/0
02:54:24 PM     0        13    0.00    0.99    0.00    0.99     1  migration/1
02:54:24 PM     0        50    0.00    4.30    0.00    4.30     0  kworker/u30:1
02:54:24 PM     0     12310    0.17    0.00    0.00    0.17     0  tuned
02:54:24 PM     0     27021    0.00    0.33    0.00    0.33     1  kworker/1:1
02:54:24 PM     0     27181    0.00   12.91    0.00   12.91     1  kworker/u30:3
02:54:24 PM     0     27228    0.00    0.33    0.00    0.33     1  kworker/1:0
02:54:24 PM     0     27329    0.17   17.55    0.00   17.72     0  stress
02:54:24 PM     0     27330    0.33   18.38    0.00   18.71     0  stress
02:54:24 PM     0     27331    0.33   18.05    0.00   18.38     1  stress
02:54:24 PM     0     27332    0.33   21.36    0.00   21.69     1  stress
02:54:24 PM     0     27333    0.33   15.89    0.00   16.23     0  stress

posted @ 2021-03-15 14:56  ainimore  阅读(53)  评论(0编辑  收藏  举报