安装
https://alibaba.github.io/arthas/install-detail.html#
arthas-boot启动
1 | https://alibaba.github.io/arthas/arthas-boot.jar |
docker内使用
https://alibaba.github.io/arthas/docker.html#id1
代码示例
命令
jvm sysenv sysprop dashboard
查询系统信息
heapdump
dump java heap, 类似jmap命令的heap dump功能。
- dump到指定文件
1
[arthas@58205]$ heapdump /tmp/dump.hprof
thread
可用来检测cpu过高或者陷入死循环
与jstack pid
用法一致
trace
trace 命令能主动搜索 class-pattern/method-pattern 对应的方法调用路径,渲染和统计整个调用链路上的所有性能开销和追踪调用链路。[arthas@10048]$ trace com.example.springbootdemo.test.FullGC_Problem01 doWork
monitor watch
monitor 方法执行监控
对匹配 class-pattern/method-pattern的类、方法的调用进行监控。
watch 方法执行数据观测。
让你能方便的观察到指定方法的调用情况。能观察到的范围为:返回值、抛出异常、入参
jad mc redefine
jad 反编译class为java文件
mc 内存编译器
redefine 热加载class
1 | jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java |
sc sm
sc 查看JVM已加载的类信息
“Search-Class” 的简写,这个命令能搜索出所有已经加载到 JVM 中的 Class 信息。
sm 查看已加载类的方法信息
“Search-Method” 的简写,这个命令能搜索出所有已经加载了 Class 信息的方法信息