cpu暴涨如何分析

cpu暴涨如何分析

top

首先,top找一下最占用系统资源的进程

ps -mp

[root@hecs-82454 ~]# ps -mp 1376 -o THREAD,tid,time
USER     %CPU PRI SCNT WCHAN  USER SYSTEM   TID     TIME
root      0.2   -    - -         -      -     - 00:00:00
root      0.0  19    - futex_    -      -  1376 00:00:00
root      0.1  19    - futex_    -      -  1377 00:00:00
root      0.0  19    - futex_    -      -  1378 00:00:00
root      0.0  19    - futex_    -      -  1379 00:00:00
root      0.0  19    - futex_    -      -  1380 00:00:00
root      0.0  19    - futex_    -      -  1381 00:00:00
root      0.0  19    - futex_    -      -  1382 00:00:00
root      0.0  19    - futex_    -      -  1383 00:00:00
root      0.0  19    - futex_    -      -  1384 00:00:00
root      0.0  19    - futex_    -      -  1385 00:00:00

tid转换

找到占用最大的tid,就是线程号,但是这个线程需要换成16进制的

[root@hecs-82454 ~]# printf "%x\n" 1377
561

jstack打印

[root@hecs-82454 ~]# jstack 1376 |grep 561
"main" #1 prio=5 os_prio=0 tid=0x00007f34c0009800 nid=0x561 waiting on condition [0x00007f34c8c6f000]

这里只是个例子,如果线上的话会打印出很多东西,在打印出来的内容里找到自己熟悉的代码

现在补充了proc/slabinfo 打印 30s一次,最后一次slab突增6m cpu2 的软中断达到了100% ip4-frags 109 130 152 26 1 : tunables 120 60 8 : slabdata 5 5 0 ip4-frags 111 130 152 26 1 : tunables 120 60 8 : slabdata 5 5 0 ip4-frags 233 234 152 26 1 : tunables 120 60 8 : slabdata 9 9 0 flow_cache 13080 16560 112 36 1 : tunables 120 60 8 : slabdata 460 460 0 flow_cache 11460 16560 112 36 1 : tunables 120 60 8 : slabdata 460 460 0 flow_cache 16440 16560 112 36 1 : tunables 120 60 8 : slabdata 460 460 0 skbuff_head_cache 1380 2268 192 21 1 : tunables 120 60 8 : slabdata 108 108 420 skbuff_head_cache 1380 2268 192 21 1 : tunables 120 60 8 : slabdata 108 108 300 skbuff_head_cache 1620 2268 192 21 1 : tunables 120 60 8 : slabdata 108 108 360 filp 12960 19250 160 25 1 : tunables 120 60 8 : slabdata 770 770 480 filp 12960 19250 160 25 1 : tunables 120 60 8 : slabdata 770 770 300 filp 37150 37150 160 25 1 : tunables 120 60 8 : slabdata 1486 1486 0 task_struct 339 420 1504 5 2 : tunables 24 12 8 : slabdata 84 84 12 task_struct 334 415 1504 5 2 : tunables 24 12 8 : slabdata 83 83 0 task_struct 1430 1430 1504 5 2 : tunables 24 12 8 : slabdata 286 286 0 pid 772 1197 64 63 1 : tunables 120 60 8 : slabdata 19 19 0 pid 852 1197 64 63 1 : tunables 120 60 8 : slabdata 19 19 0 pid 1824 1827 64 63 1 : tunables 120 60 8 : slabdata 29 29 0 kmalloc-node 46415 54002 128 31 1 : tunables 120 60 8 : slabdata 1742 1742 240 kmalloc-node 47135 54002 128 31 1 : tunables 120 60 8 : slabdata 1742 1742 300 kmalloc-node 59272 59272 128 31 1 : tunables 120 60 8 : slabdata 1912 1912 0
最新发布
04-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值