线上问题分析之java dump文件生成
一、查看java进程
jps or ps aux | grep java
二、生成dump文件
jmap -dump:live,format=b,file=xxxx.bin 进程ID
三、查看dump文件:
jhat启动分析web服务:
jhat -J-mx512m xxxx.bin
Reading from xxxx.bin... Dump file created Thu Mar 19 18:23:18 CST 2020 Snapshot read, resolving... Resolving 1511510 objects... Chasing references, expect 302 dots.............................................................................................................................................................................................................................................................................................................. Eliminating duplicate references.............................................................................................................................................................................................................................................................................................................. Snapshot resolved. Started HTTP server on port 7000 Server is ready.
or
jvisualvm 启动可视化工具
四、查看线程栈
jstack 进程ID
五、gc 查看
jstat -gc 进程ID //实时gc
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000
jstat -gc 6750 1000 10 //间隔1s,打印10s
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000 10752.0 10752.0 0.0 0.0 65536.0 36715.2 175104.0 0.0 4480.0 779.9 384.0 76.4 0 0.000 0 0.000 0.000
六、附加订阅