0. 概述
主要记录Arthas,async-profiler两个工具的基本信息
1. Arthas
1. classloader 查看 classloader 的继承树,urls,类加载信息
classloader -t
2. dashboard 当前系统的实时数据面板,包含线程、堆栈信息
dashboard -i 2000 ## 2s刷新一次
3. jvm 查看当前进程的JVM信息
jvm
4. memory 查看 JVM 内存信息
memory
5. thread 查看当前线程信息,查看线程的堆栈
thread
thread pid
thread -b ## 当前阻塞线程
thread -n 5 ## 输出当前最忙的top 5线程
6. heapdump 类似 jmap 命令的 heap dump 功能
heapdump /var/xxx.hprof
7. profiler 使用async-profiler生成火焰图,详细参数参考async-profiler
profiler start --event alloc (cpu)
........
profiler stop --format flamegraph
8. vmtool 利用JVMTI接口,实现查询内存对象,强制 GC 等功能
vmtool --action getInstances --className java.lang.String --limit 10 ## 获取对象
vmtool --action forceGc ## 强制FGC
2. async-profiler
1. 采集指定java进程CPU数据,生成热力图
./asprof -d 30 -f /data/downloads/flamegraph.html pid
.....
./asprof stop pid










网友评论