arthas(阿尔萨斯)主要用于排查线上问题,但需要有shell权限,会有安全风险,但还是值的学习;
线上问题受阻时提供一种新的解决思路 扩展思路,解决思路很重要,工具没有可以创造,但如果没有思路有工具也无从下手;可在公司安全架构内找类似工具或者自己创建
java -jar arthas-boot.jar
使用cmd shell,切勿使用Git Bash shell。
dashboard
统计1秒内cpu使用率最高的n个线程:
thread -n 3 -i 1000
查询出当前被阻塞的线程:
thread -b
指定采样的时间间隔:
thread -i 1000
说明 | 命令 |
---|---|
启动 profiler | profiler start |
获取已采集的 sample 的数量 | profiler getSamples |
查看 profiler 状态 | profiler status |
停止 profiler 生成 html 格式结果 | profiler stop —format html |
![]() |
jad com.sli.Test
修改
vmoption HeapDumpOnOutOfMemoryError true
trace 待监控方法的全类名 待监控的方法名 —skipJDKMethod false 包含 jdk 里的函数调用
trace --skipJDKMethod false 包 方法
观察函数调用的入参、this 对象和返回值
watch 包 方法 -x 1
stack 包 方法