1.下载arthas-bin.zip,并上传到目标应用服务器;
2.解压到某个目录
unzip arthas-bin.zip -d ./
3.启动Arthas,
java -jar arthas-boot.jar
选择你需要定位的jar(Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER)
根据序号进行选择。
4.在Arthas中执行thread,可以看到线程清单
thread 线程id:查看具体线程堆栈
5.输出需要定位的方法(适用于已知哪个功能慢的场景放会显示耗时):
trace com.hello.test.service.impl.MiddleServiceImpl updateById -n 5 --skipJDKMethod false