Linux之资源使用率过高排查
1、查看系统负载情况
top
如果负载大于CPU核数说明系统已经超负载运行

2、查看CPU信息
%usr:如果 %usr 很高,这意味着大量的CPU时间被用于执行用户级别的进程,这可能是因为有很多计算密集型的应用在运行。CPU密集型
%sys:如果 %sys 很高,这意味着CPU花费了大量时间在操作系统的内核代码上,这可能是因为系统正在进行大量的磁盘I/O操作、网络通信或者其他系统调用。IO密集型
[root@host sa]# mpstat -P ALL 1 40
Linux 3.10.0-957.el7.x86_64 (h3c-prometheus) 2024年11月21日 _x86_64_ (2 CPU)
15时22分46秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
15时22分47秒 all 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.50
15时22分47秒 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分47秒 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分47秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
15时22分48秒 all 1.01 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 98.49
15时22分48秒 0 1.98 0.00 0.99 0.00 0.00 0.00 0.00 0.00 0.00 97.03
15时22分48秒 1 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.00
15时22分48秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
15时22分49秒 all 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 99.50
15时22分49秒 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分49秒 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分49秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
15时22分50秒 all 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分50秒 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分50秒 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分50秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
15时22分51秒 all 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分51秒 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
15时22分51秒 1 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 99.00
3、查看进程
查看占用CPU使用率最高的进程
[root@host sa]# pidstat 1 10
Linux 3.10.0-957.el7.x86_64 (h3c-prometheus) 2024年11月21日 _x86_64_ (2 CPU)
15时35分29秒 UID PID %usr %system %guest %CPU CPU Command
15时35分30秒 0 38074 0.00 0.99 0.00 0.99 0 pidstat
15时35分30秒 0 38182 0.99 0.00 0.00 0.99 1 titanagent
15时35分30秒 0 41197 0.99 0.00 0.00 0.99 0 hekad
15时35分30秒 UID PID %usr %system %guest %CPU CPU Command
15时35分31秒 UID PID %usr %system %guest %CPU CPU Command
15时35分32秒 0 38074 0.00 1.00 0.00 1.00 0 pidstat
15时35分32秒 UID PID %usr %system %guest %CPU CPU Command
15时35分33秒 0 38074 0.00 1.00 0.00 1.00 0 pidstat
15时35分33秒 0 38182 1.00 0.00 0.00 1.00 0 titanagent
15时35分33秒 UID PID %usr %system %guest %CPU CPU Command
15时35分34秒 0 41197 1.00 0.00 0.00 1.00 0 hekad
15时35分34秒 UID PID %usr %system %guest %CPU CPU Command
15时35分35秒 0 38074 1.00 0.00 0.00 1.00 0 pidstat
15时35分35秒 0 38182 0.00 1.00 0.00 1.00 0 titanagent
15时35分35秒 0 41197 0.00 1.00 0.00 1.00 0 hekad
15时35分35秒 UID PID %usr %system %guest %CPU CPU Command
15时35分36秒 0 38074 0.00 1.00 0.00 1.00 0 pidstat
15时35分36秒 UID PID %usr %system %guest %CPU CPU Command
15时35分37秒 0 38074 0.00 1.00 0.00 1.00 0 pidstat
4、查看磁盘读写
查看哪个磁盘读写高
[root@host sa]# iostat 1 10
Linux 3.10.0-957.el7.x86_64 (h3c-prometheus) 2024年11月21日 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.16 0.00 0.17 0.00 0.01 99.66
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
vda 0.62 0.05 4.12 548125 45243469
vdb 0.00 0.00 0.00 3932 0
vdc 0.00 0.00 0.00 7638 27229
vdd 0.00 0.00 0.00 2720 0
scd0 0.00 0.00 0.00 17832 0
dm-0 0.55 0.05 4.12 506657 45226999
dm-1 0.00 0.00 0.00 2460 0
dm-2 0.00 0.00 0.00 4086 27229

浙公网安备 33010602011771号