jvm-gclog输出常用参数要不要了解下?
2018-09-19 本文已影响44人
tianlang136520
-XX:+PrintHeapAtGC
-verbose:gc
-XX:+PrintTenuringDistribution
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintReferenceGC
-XX:+PrintGCTimeStamps
-XX:+PrintGC
1、-XX:+PrintHeapAtGC(每次gc(yonggc,fullgc) 都会输出gc前后堆信息)
CMS中 log:
{Heap before GC invocations=1 (full 0):
par new generation total 46080K, used 42256K [0x00000007b3800000, 0x00000007b6a00000, 0x00000007b6a00000)
eden space 40960K, 99% used [0x00000007b3800000, 0x00000007b5fc6ae0, 0x00000007b6000000)
from space 5120K, 29% used [0x00000007b6500000, 0x00000007b667d750, 0x00000007b6a00000)
to space 5120K, 0% used [0x00000007b6000000, 0x00000007b6000000, 0x00000007b6500000)
concurrent mark-sweep generation total 153600K, used 0K [0x00000007b6a00000, 0x00000007c0000000, 0x00000007c0000000)
Metaspace used 3288K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 362K, capacity 388K, committed 512K, reserved 1048576K
2018-08-03T17:40:09.703-0800: [GC (Allocation Failure) 2018-08-03T17:40:09.703-0800: [ParNew
Desired survivor size 3145728 bytes, new threshold 3 (max 3)
- age 2: 1492936 bytes, 1492936 total
: 42256K->1686K(46080K), 0.0013712 secs] 42256K->1686K(199680K), 0.0014078 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap after GC invocations=2 (full 0):
par new generation total 46080K, used 1686K [0x00000007b3800000, 0x00000007b6a00000, 0x00000007b6a00000)
eden space 40960K, 0% used [0x00000007b3800000, 0x00000007b3800000, 0x00000007b6000000)
from space 5120K, 32% used [0x00000007b6000000, 0x00000007b61a5b18, 0x00000007b6500000)
to space 5120K, 0% used [0x00000007b6500000, 0x00000007b6500000, 0x00000007b6a00000)
concurrent mark-sweep generation total 153600K, used 0K [0x00000007b6a00000, 0x00000007c0000000, 0x00000007c0000000)
Metaspace used 3288K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 362K, capacity 388K, committed 512K, reserved 1048576K
}
ParallelGC中log:
{Heap before GC invocations=5 (full 0):
PSYoungGen total 45056K, used 38644K [0x00000007bce00000, 0x00000007c0000000, 0x00000007c0000000)
eden space 38912K, 99% used [0x00000007bce00000,0x00000007bf3bd328,0x00000007bf400000)
from space 6144K, 0% used [0x00000007bfa00000,0x00000007bfa00000,0x00000007c0000000)
to space 6144K, 0% used [0x00000007bf400000,0x00000007bf400000,0x00000007bfa00000)
ParOldGen total 153600K, used 1509K [0x00000007b3800000, 0x00000007bce00000, 0x00000007bce00000)
object space 153600K, 0% used [0x00000007b3800000,0x00000007b39797c8,0x00000007bce00000)
Metaspace used 3290K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 362K, capacity 388K, committed 512K, reserved 1048576K
2018-08-03T17:50:29.631-0800: [GC (Allocation Failure)
Desired survivor size 3670016 bytes, new threshold 2 (max 3)
[PSYoungGen: 38644K->3072K(45056K)] 40154K->4581K(198656K), 0.0037607 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
Heap after GC invocations=5 (full 0):
PSYoungGen total 45056K, used 3072K [0x00000007bce00000, 0x00000007c0000000, 0x00000007c0000000)
eden space 38912K, 0% used [0x00000007bce00000,0x00000007bce00000,0x00000007bf400000)
from space 6144K, 50% used [0x00000007bf400000,0x00000007bf700030,0x00000007bfa00000)
to space 3584K, 0% used [0x00000007bfc80000,0x00000007bfc80000,0x00000007c0000000)
ParOldGen total 153600K, used 1509K [0x00000007b3800000, 0x00000007bce00000, 0x00000007bce00000)
object space 153600K, 0% used [0x00000007b3800000,0x00000007b39797c8,0x00000007bce00000)
Metaspace used 3290K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 362K, capacity 388K, committed 512K, reserved 1048576K
}
2、-verbose:gc (每次gc(yonggc,fullgc) 输出前后结果信息)
CMS&ParallelGC中log:
[GC (Allocation Failure) 37929K->1720K(198656K), 0.0015626 secs]
[GC (Allocation Failure) 40362K->1576K(198656K), 0.0018508 secs]
3、-XX:+PrintTenuringDistribution
CMS中log:
Desired survivor size 3145728 bytes, new threshold 3 (max 3)
- age 1: 1528520 bytes, 1528520 total
Desired survivor size 3145728 bytes, new threshold 3 (max 3)
- age 2: 1493000 bytes, 1493000 total
ParallelGC中log:
Desired survivor size 6291456 bytes, new threshold 3 (max 3)
Desired survivor size 6291456 bytes, new threshold 3 (max 3)
Desired survivor size 6291456 bytes, new threshold 3 (max 3)
4、单独使用:-XX:+PrintGCDateStamps、-XX:+PrintReferenceGC 、-XX:+PrintGCTimeStamps
ParallelGC中log:
无
CMS中log:
无
5、-XX:+PrintGCDetails
CMS中log:
[GC (Allocation Failure) [ParNew: 40141K->1529K(46080K), 0.0016821 secs] 40141K->1529K(199680K), 0.0017271 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [ParNew: 42260K->1618K(46080K), 0.0015961 secs] 42260K->1618K(199680K), 0.0016258 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [ParNew: 42145K->1637K(46080K), 0.0013662 secs] 42145K->1637K(199680K), 0.0014078 secs] [Times: user=0.01 sys=0.01, real=0.00 secs]
[GC (Allocation Failure) [ParNew: 42366K->0K(46080K), 0.0049625 secs] 42366K->1502K(199680K), 0.0049983 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
ParallelGC中log:
[GC (Allocation Failure) [PSYoungGen: 37929K->1616K(45056K)] 37929K->1624K(198656K), 0.0022814 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [PSYoungGen: 40258K->1664K(45056K)] 40266K->1672K(198656K), 0.0019262 secs] [Times: user=0.01 sys=0.01, real=0.00 secs]
[GC (Allocation Failure) [PSYoungGen: 40062K->1584K(45056K)] 40070K->1592K(198656K), 0.0010587 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [PSYoungGen: 40225K->0K(45056K)] 40233K->1501K(198656K), 0.0018711 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
6、-XX:+PrintGC
CMS中log:
7.774: [GC (Allocation Failure) 32768K->17253K(200704K), 0.0833318 secs]
23.877: [GC (Allocation Failure) 50021K->52439K(200704K), 0.0543904 secs]
40.501: [GC (Allocation Failure) 85207K->84427K(200704K), 0.0473820 secs]
56.633: [GC (Allocation Failure) 117195K->116277K(200704K), 0.0425909 secs]
73.247: [GC (Allocation Failure) 149045K->148270K(200704K), 0.0435195 secs]
73.291: [GC (CMS Initial Mark) 148386K(200704K), 0.0011136 secs]
73.396: [GC (CMS Final Remark) 148767K(200704K), 0.0028249 secs]
75.464: [GC (CMS Initial Mark) 153371K(200704K), 0.0033355 secs]
80.679: [GC (CMS Final Remark) 163165K(200704K), 0.0045811 secs]
82.747: [GC (CMS Initial Mark) 167081K(200704K), 0.0065648 secs]
82.858: [GC (CMS Final Remark) 168061K(200704K), 0.0061034 secs]
84.933: [GC (CMS Initial Mark) 171915K(200704K), 0.0108552 secs]
85.047: [GC (CMS Final Remark) 171915K(200704K), 0.0085279 secs]
87.120: [GC (CMS Initial Mark) 175833K(200704K), 0.0084935 secs]
看看你需要那种?
是的组合在一起👪,才是真爱~
我一般这么组合:
-XX:+PrintHeapAtGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails
-XX:+PrintReferenceGC -XX:+PrintTenuringDistribution
-Xloggc:/export/Logs/xxxxxxx/tomcat7-cms-gc.log