1. The following is the arthas official website with very detailed usage documentation:
2. Officially recommended downloads and usage methods:
# 自己找个文件夹下载arthas jar包
cd /home
# 下载
curl -O https://arthas.aliyun.com/arthas-boot.jar
# 运行
java -jar arthas-boot.jar
3. Select the monitored jar port (just enter the number)
4. Command line input: dashboard
5. thread 19 to view thread running
6. Decompile jad command :
# 查看类
jad cn.test.mobile.controller.order.OrderController
# 查看方法
jad cn.test.mobile.controller.order.OrderController getOrderInfo
Function: Check whether the compiled version is correct
7. trace command :
Function: Output the internal calling path of the method and the time consumption of each node on the path
# 命令-j是指过滤掉jdk中的方法
trace -j cn.test.mobile.controller.order.OrderController getOrderInfo
# 查看耗时长的: 单位ms ==>大于10ms 的
trace -j cn.test.mobile.controller.order.OrderController getOrderInfo '#cost > 10'
8. watch command :
Function: Monitor the input parameters and return values of the method
parameter name | Parameter Description |
class-pattern | Class name expression matching |
method-pattern | Method name expression matching |
express | observation expression |
condition-express | conditional expression |
[b] | Observe before method call |
[e] | Observe after method exception |
[s] | Observe after the method returns |
[f] | Observe after the method ends (normal return and exception return) , default option |
[E] | Enable regular expression matching. The default is wildcard matching. |
[x:] | Specifies the attribute traversal depth of the output result, the default is 1 |
# 遍历深度2
watch cn.test.mobile.controller.order.OrderController getOrderInfo "{params,returnObj}" -x 2
7. For many other commands, please check the official website