有的时候在服务器上面可能会出现cpu过高的情况出现,怎么定位这种问题呢
1.通过top命令来定位占用cpu最高的进程
top - 11:46:12 up 72 days, 53 min, 0 users, load average: 0.91, 0.95, 0.92
Tasks: 12 total, 1 running, 11 sleeping, 0 stopped, 0 zombie
%Cpu(s): 23.6 us, 2.9 sy, 0.1 ni, 71.7 id, 0.2 wa, 0.0 hi, 1.5 si, 0.0 st
KiB Mem : 16425212 total, 3039580 free, 4343320 used, 9042312 buff/cache
KiB Swap: 969964 total, 851944 free, 118020 used. 11403912 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
46 shiyanl+ 20 0 929992 76772 29728 S 9.0 0.5 0:16.29 node
669 shiyanl+ 20 0 2225384 33292 17040 S 2.7 0.2 0:03.73 java
57 shiyanl+ 20 0 899596 36752 28092 S 0.3 0.2 0:01.78 node
如上占用最高为669
2.通过top命令定位进程里面占用cpu最高的线程
top -Hp pid
top - 11:47:57 up 72 days, 55 min, 0 users, load average: 0.51, 0.80