阿里Java诊断工具 arthas - 排查线上环境内存使用过大、线程cpu使用率高问题_arthas排查内存高问题-优快云博客
arthas--vmtool查看内存对象_arthas查看对象_韩师学子--小倪的博客-优快云博客
1.安装arthas
wget https://alibaba.github.io/arthas/arthas-boot.jar
2.启动arthas
java -jar arthas-boot.jar
3.诊断命令
3.1 trace 方法全路径
查看调用过程,以及每一步的耗时
trace com.cctest.arthas_demo.controller.StressSceneController timeCost
3.2 watch
查看接口入参、出参、异常
watch com.cctest.arthas_demo.controller.StressSceneController login "{params[0],params[1],returnObj}"
3.3使用tt定位异常
tt -t com.cctest.arthas_demo.controller.StressSceneController login
3.4 vmtool
查看指定对象的快照
vmtool --action getInstances --className class路径 -x 5
3.5 查看线程阻塞情况
thread -b
如果生产环境不能直接登陆,可以使用 Arthas Tunnel Server
3.6 getstatic
查看类的静态属性
getstatic class_name field_name