java高CPU占用的排查

  1. 通过ps auxw --sort=-%cputop命令查看各个进程CPU使用率。
  2. 通过ps -mp pid -o THREAD,tid,time命令查看线程列表。
  3. 在线程列表中找到CPU占用高并且持续时间长的TID。
  4. 将需要的线程ID转换为16进制格式printf "%x\n" tid
  5. 通过jstack pid |grep tid -A 30命令打印堆栈信息,找到出问题部分代码。
文章导航