1 查看JVM状态信息jstat命令格式
jstat-option -t -h num pid interval count
-option:参数
-t打印收集信息的时间
-h每num行打印一个head
pid监控的进程号
interval间隔多少毫秒采集一次信息
count一共采集多少次信息。
2 分析过程命令
(1)查看JVM启动参数和进程号
jps -mlvV
(2)看堆内存分配情况
jstat -gccapacity -t -h 5 2808 100 10
(3)看垃圾回收情况
jstat -gcutil -t -h 5 2808 100 10
jstat -gccause -t -h 5 2808 100 10
-gcutil:查看堆内存占用和回收情况。
-gccause:查看最近一次垃圾回收原因。
(4)如果堆内存持续占用率很高,查看堆内存内对象情况
jmap-histo pid
(5)如果向查看更多信息,在cmd里运行jstat查看jstat的其他参数。
(6)更多的资料信息,请上网查询查找。
3 附录
(1)jstat –gccapacity 输出结果
| Column | Description |
| NGCMN | Minimum new generation capacity (KB). |
| NGCMX | Maximum new generation capacity (KB). |
| NGC | Current new generation capacity (KB). |
| S0C | Current survivor space 0 capacity (KB). |
| S1C | Current survivor space 1 capacity (KB). |
| EC | Current eden space capacity (KB). |
| OGCMN | Minimum old generation capacity (KB). |
| OGCMX | Maximum old generation capacity (KB). |
| OGC | Current old generation capacity (KB). |
| OC | Current old space capacity (KB). |
| PGCMN | Minimum permanent generation capacity (KB). |
| PGCMX | Maximum Permanent generation capacity (KB). |
| PGC | Current Permanent generation capacity (KB). |
| PC | Current Permanent space capacity (KB). |
| YGC | Number of Young generation GC Events. |
| FGC | Number of Full GC Events. |
(2)jstat –util 输出结果
| Column | Description |
| S0 | Survivor space 0 utilization as a percentage of the space's current capacity. |
| S1 | Survivor space 1 utilization as a percentage of the space's current capacity. |
| E | Eden space utilization as a percentage of the space's current capacity. |
| O | Old space utilization as a percentage of the space's current capacity. |
| P | Permanent space utilization as a percentage of the space's current capacity. |
| YGC | Number of young generation GC events. |
| YGCT | Young generation garbage collection time. |
| FGC | Number of full GC events. |
| FGCT | Full garbage collection time. |
| GCT | Total garbage collection time. |
(3)jstat –gccause
| Column | Description |
| LGCC | Cause of last Garbage Collection. |
| GCC | Cause of current Garbage Collection. |
(4)jstat –gc
| Column | Description |
| S0C | Current survivor space 0 capacity (KB). |
| S1C | Current survivor space 1 capacity (KB). |
| S0U | Survivor space 0 utilization (KB). |
| S1U | Survivor space 1 utilization (KB). |
| EC | Current eden space capacity (KB). |
| EU | Eden space utilization (KB). |
| OC | Current old space capacity (KB). |
| OU | Old space utilization (KB). |
| PC | Current permanent space capacity (KB). |
| PU | Permanent space utilization (KB). |
| YGC | Number of young generation GC Events. |
| YGCT | Young generation garbage collection time. |
| FGC | Number of full GC events. |
| FGCT | Full garbage collection time. |
| GCT | Total garbage collection time. |
JVM性能调优实战
本文详细介绍JVM性能调优的全过程,包括使用jstat、jmap等工具进行监控和诊断的方法,帮助开发者理解如何有效地分析和解决JVM性能问题。
2万+

被折叠的 条评论
为什么被折叠?



