jmap、jstat命令说明

jmap

使用G1收集器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 /home/q/java/default/bin/jmap -heap 29591
Attaching to process ID 29591, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.45-b08 //显示JVM版本号

using thread-local object allocation.
Garbage-First (G1) GC with 10 thread(s) //使用了G1垃圾收集器,启用10个线程

Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70 //堆内存的使用比例在30%~60%之间
MaxHeapSize = 8589934592 (8192.0MB) //最大堆内存大小为8192.0MB
NewSize = 5368709120 (5120.0MB)
MaxNewSize = 17592186044415 MB
OldSize = 5452592 (5.1999969482421875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 268435456 (256.0MB) //持久代大小为256MB
MaxPermSize = 268435456 (256.0MB) //持久代最大大小为256MB
G1HeapRegionSize = 4194304 (4.0MB)

Heap Usage:
G1 Heap:
regions = 2048
capacity = 8589934592 (8192.0MB)
used = 2063597568 (1968.0MB)
free = 6526337024 (6224.0MB)
24.0234375% used
G1 Young Generation: //年轻代信息
Eden Space:
regions = 492
capacity = 5637144576 (5376.0MB)
used = 2063597568 (1968.0MB)
free = 3573547008 (3408.0MB)
36.607142857142854% used
Survivor Space:
regions = 0
capacity = 0 (0.0MB)
used = 0 (0.0MB)
free = 0 (0.0MB)
0.0% used
G1 Old Generation: //年老代信息
regions = 0
capacity = 2952790016 (2816.0MB)
used = 0 (0.0MB)
free = 2952790016 (2816.0MB)
0.0% used
Perm Generation: //持久代信息
capacity = 268435456 (256.0MB)
used = 37596920 (35.85521697998047MB)
free = 230838536 (220.14478302001953MB)
14.00594413280487% used

使用cms收集器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/home/q/java/default/bin/jmap -heap 20396
Attaching to process ID 20396, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.45-b08

using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC

Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 34359738368 (32768.0MB)
NewSize = 21474836480 (20480.0MB)
MaxNewSize = 21474836480 (20480.0MB)
OldSize = 12884901888 (12288.0MB)
NewRatio = 2
SurvivorRatio = 3
PermSize = 268435456 (256.0MB)
MaxPermSize = 268435456 (256.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 17179869184 (16384.0MB)
used = 7197689648 (6864.251754760742MB)
free = 9982179536 (9519.748245239258MB)
41.89606783911586% used
Eden Space:
capacity = 12884901888 (12288.0MB)
used = 7183594472 (6850.809547424316MB)
free = 5701307416 (5437.190452575684MB)
55.75203082213799% used
From Space:
capacity = 4294967296 (4096.0MB)
used = 14095176 (13.442207336425781MB)
free = 4280872120 (4082.557792663574MB)
0.32817889004945755% used
To Space:
capacity = 4294967296 (4096.0MB)
used = 0 (0.0MB)
free = 4294967296 (4096.0MB)
0.0% used
concurrent mark-sweep generation:
capacity = 12884901888 (12288.0MB)
used = 0 (0.0MB)
free = 12884901888 (12288.0MB)
0.0% used
Perm Generation:
capacity = 268435456 (256.0MB)
used = 21351800 (20.36266326904297MB)
free = 247083656 (235.63733673095703MB)
7.95416533946991% used

jstat

1
2
3
4
5
6
7
8
9
jstat -gcutil 54863 1000
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 100.00 100.00 100.00 14.82 8 50.530 0 0.000 50.530
0.00 0.00 0.00 100.00 14.82 9 68.780 0 0.000 68.780
1
2
3
4
5
6
7
8
9
10
S0:Heap上的 Survivor space 0 段已使用空间的百分比
S1:Heap上的 Survivor space 1 段已使用空间的百分比
E: Heap上的 Eden space 段已使用空间的百分比
O: Heap上的 Old space 段已使用空间的百分比
P: Perm space 已使用空间的百分比
YGC:从程序启动到采样时发生Young GC的次数
YGCT:Young GC所用的时间(单位秒)
FGC:从程序启动到采样时发生Full GC的次数
FGCT:Full GC所用的时间(单位秒)
GCT:用于垃圾回收的总时间(单位秒)