cpu使用率过高和jvm old占用过高排查

原文链接: https://my.oschina.net/who7708/blog/3061731

cpu占用过高排查思路

  • top 查看占用cpu的进程 pid
top - 17:50:38 up 119 days, 23:39,  1 user,  load average: 0.00, 0.08, 0.07
Tasks: 187 total,   1 running, 186 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.4 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 32780552 total,  8852484 free, 11627780 used, 12300288 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 19048468 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  ............
  • top -Hp pid 查看进程中占用cpu过高的线程id tid

  • printf '%x\n' tid 转化为十六进制

~ printf '%x\n' xxx
  • jstack pid | grep tid 的十六进制查看堆栈信息定位
jstack xxx | grep `33f0`
"jenkins.util.Timer [#7]" #73 daemon prio=5 os_prio=0 tid=0x00002b7c0c2f9000 nid=`0x33f0` waiting on condition [0x00002b7c1f47e000]

jvm old区占用过高排查思路

  • top查看占用cpu高的进程
  • jstat -gcutil pid 时间间隔 查看gc状况
  • jmap -dump:format=b,file=name.dump pid 导出dump文件
  • 用visualVM分析dump文件

转载于:https://my.oschina.net/who7708/blog/3061731

你可能感兴趣的:(cpu使用率过高和jvm old占用过高排查)