0
点赞
收藏
分享

微信扫一扫

Java问题排查-CPU飙高

烟中雯城 2021-09-21 阅读 62

方法一 命令行工具

  1. 查看哪些Java进程在运行
ps -ef | grep -i java

#或者 

jps -v
  1. 查看具体进程线程占用情况,(shift+p 按cpu排序,shift+m 按内存排序)
top -Hp java进程ID

  1. 将对应的进程转换为16进制,jstack进程默认为16进制。
jstack Java进程PID | grep -i `printf "%x\n" 最高的线程Id`

方法二 arthas工具

按照官方文档安装工具:https://arthas.aliyun.com/doc/

  1. 输入dashboard命令查看整体情况

  2. thread命令查看线程整体情况


  3. thread 线程Id查看线程的具体情况


4 将堆内存dump下来,arthas的heapdump文档:https://arthas.aliyun.com/doc/heapdump.html

heapdump --live /tmp/dump.hprof

5 在headphero.io网站上分析dump的文件。
https://heaphero.io/

举报

相关推荐

0 条评论