JVM自带监控工具
Posted yifansj
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JVM自带监控工具相关的知识,希望对你有一定的参考价值。
1. jstat
jstat -gcutil 67008 5s 3
查看pid为67008的进程的堆内存各个区域占用总容量百分比,
5秒刷新一次,共查询3次
运行结果如下:
说明:
- S0: Survivor0(新生代Survivor)是空的
- S1: Survivor1(新生代Survivor)是空的
- E: Eden(新生代Eden)占用0.38%
- O: Old(老年代)占用48.24%
- M:
- CCS:
- YGC: Young GC==> Minor GC ==> 新生代GC的次数
- YGCT: YGC 耗时0.578秒
- FGC: Full GC==>老年代GC的次数
- FGCT: FGC总耗时1.067秒
- GCT: 所有GC总耗时1.645秒
2. jinfo
jinfo -flags process_id
查看jvm的参数
3. jmap
jmap -heap 1234 (1234为进程号)
打印堆信息
-heap:打印heap空间的概要,这里可以粗略的检验heap空间的使用情况。
例:
jmap -heap 12345
输出:
Attaching to process ID 2657, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 1.5.0_16-b02
using thread-local object allocation.
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 67108864 (64.0MB)
NewSize = 655360 (0.625MB)
MaxNewSize = 4294901760 (4095.9375MB)
OldSize = 1441792 (1.375MB)
NewRatio = 12
SurvivorRatio = 8
PermSize = 8388608 (8.0MB)
MaxPermSize = 67108864 (64.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):----------------------------------------新生代区
capacity = 4521984 (4.3125MB)
used = 1510200 (1.4402389526367188MB)
free = 3011784 (2.8722610473632812MB)
33.39684527853261% used
Eden Space:--------------------------------------------------------------------伊甸园区
capacity = 4063232 (3.875MB)
used = 1495992 (1.4266891479492188MB)
free = 2567240 (2.4483108520507812MB)
36.81778446320565% used
From Space:-------------------------------------------------------------------年轻代(幸存者乐园1)
capacity = 458752 (0.4375MB)
used = 14208 (0.0135498046875MB)
free = 444544 (0.4239501953125MB)
3.0970982142857144% used
To Space:-----------------------------------------------------------------------------年轻代(幸存者乐园2)
capacity = 458752 (0.4375MB)
used = 0 (0.0MB)
free = 458752 (0.4375MB)
0.0% used
concurrent mark-sweep generation:-------------------------------------------------老年代
capacity = 8589934592 (8192.0MB)
used = 0 (0.0MB)
free = 8589934592 (8192.0MB)
0.0% used
Perm Generation:----------------------------------------------------------------------永久代
capacity = 11796480 (11.25MB)
used = 11712040 (11.169471740722656MB)
free = 84440 (0.08052825927734375MB)
99.28419325086806% used
-histo:这里会生成一个类的统计报表,此表简单无比,如显示什么类有多少个实例,共占了多少字节等,如下:
Size Count Class description
-------------------------------------------------------
8394352 105 long[]
8293192 57202 char[]
7834776 14157 byte[]
6713592 53743 * ConstMethodKlass
4194320 1 com.xjawa.cms5server.Kontent[]
4055072 12319 int[]
3291104 85082 * SymbolKlass
3016040 53743 * MethodKlass
2774936 4253 * ConstantPoolKlass
1871480 4253 * InstanceKlassKlass
1811808 3990 * ConstantPoolCacheKlass
1488672 62028 java.lang.String
1203280 13258 java.lang.Object[]
以上是关于JVM自带监控工具的主要内容,如果未能解决你的问题,请参考以下文章