2020-01-09T20:53:25.970+0800: 899.957: [Full GC (Allocation Failure) 2048M->355M(1192M), 0.8310098 secs]
[Eden: 0.0B(816.0M)->0.0B(472.0M) Survivors: 0.0B->0.0B Heap: 2048.0M(2048.0M)->355.5M(1192.0M)], [Metaspace: 43882K->43741K(1089536K)]
[Times: user=0.86 sys=0.10, real=0.83 secs]
2020-01-09T20:57:40.986+0800: 1154.972: [Full GC (Allocation Failure) 2047M->79M(272M), 0.4907389 secs]
[Eden: 0.0B(816.0M)->0.0B(104.0M) Survivors: 0.0B->0.0B Heap: 2047.9M(2048.0M)->79.8M(272.0M)], [Metaspace: 43843K->43831K(1089536K)]
[Times: user=0.44 sys=0.10, real=0.49 secs]
2020-01-09T21:04:05.861+0800: 1539.847: [Full GC (Allocation Failure) 2047M->224M(752M), 0.6655056 secs]
[Eden: 0.0B(816.0M)->0.0B(296.0M) Survivors: 0.0B->0.0B Heap: 2047.6M(2048.0M)->224.8M(752.0M)], [Metaspace: 43993K->43981K(1089536K)]
[Times: user=0.65 sys=0.09, real=0.66 secs]
2020-01-09T21:20:02.111+0800: 2496.097: [Full GC (Allocation Failure) 2047M->242M(816M), 0.6904842 secs]
[Eden: 0.0B(816.0M)->0.0B(320.0M) Survivors: 0.0B->0.0B Heap: 2047.5M(2048.0M)->242.8M(816.0M)], [Metaspace: 44214K->44202K(1089536K)]
[Times: user=0.67 sys=0.11, real=0.69 secs]
服务器GC频繁 youngGC 和少部分的FullGC
其中FullGC的效果非常明显,感觉年轻代小了,导致很多可以在年轻代回收的对象却到了老年代才回收
还有就是没有发生MixGC
每次FullGC前存在
2020-01-09T21:20:01.779+0800: 2495.765: [GC pause (G1 Evacuation Pause) (young)
(to-space exhausted), 0.3133147 secs]
[Parallel Time: 279.5 ms, GC Workers: 4]
[GC Worker Start (ms): Min: 2495765.2, Avg: 2495765.3, Max: 2495765.3, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.6, Avg: 0.7, Max: 0.9, Diff: 0.3, Sum: 3.0]
[Update RS (ms): Min: 29.9, Avg: 30.1, Max: 30.3, Diff: 0.4, Sum: 120.3]
[Processed Buffers: Min: 107, Avg: 127.8, Max: 152, Diff: 45, Sum: 511]
[Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Object Copy (ms): Min: 246.7, Avg: 248.0, Max: 248.6, Diff: 1.9, Sum: 992.0]
[Termination (ms): Min: 0.0, Avg: 0.4, Max: 1.7, Diff: 1.7, Sum: 1.7]
[Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 4]
[GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
[GC Worker Total (ms): Min: 279.2, Avg: 279.3, Max: 279.3, Diff: 0.1, Sum: 1117.1]
[GC Worker End (ms): Min: 2496044.5, Avg: 2496044.6, Max: 2496044.6, Diff: 0.0]
[Code Root Fixup: 0.0 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.1 ms]
[Other: 33.7 ms]
[Evacuation Failure: 30.7 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 2.5 ms]
[Humongous Register: 0.0 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 0.0 ms]
[Eden: 88.0M(816.0M)->0.0B(816.0M) Survivors: 0.0B->0.0B Heap: 2047.5M(2048.0M)->2047.5M(2048.0M)]
[Times: user=0.40 sys=0.08, real=0.32 secs]
2020-01-09T21:20:02.093+0800: 2496.079: [GC pause (G1 Evacuation Pause) (young), 0.0176265 secs]
[Parallel Time: 16.9 ms, GC Workers: 4]
[GC Worker Start (ms): Min: 2496078.9, Avg: 2496084.2, Max: 2496087.0, Diff: 8.1]
[Ext Root Scanning (ms): Min: 0.0, Avg: 0.7, Max: 2.9, Diff: 2.9, Sum: 2.9]
[Update RS (ms): Min: 8.7, Avg: 10.8, Max: 13.7, Diff: 5.0, Sum: 43.1]
[Processed Buffers: Min: 46,
调试步骤 InitiatingHeapOccupancyPercent 调低了1/3 G1ReservePercent 扩大了2倍
由于本应用会产生大量的大对象,所以需要调低region的数量,让每个region大一点,以防对象不经过Young,直接到old区
GC pause (G1 Humongous Allocation) (young) 直到不出现这个为准 (XX:G1HeapRegionSize)
上述优化之后,出现了mixGC 但是还是会出现 to-space exhausted
原因查看: Young区E:S1:S2=8:1:1,导致每个S只有81.6M,当S中存在88M的对象要复制到S时,S没有足够的空间,导致to-space exhausted,
目前的GC日志
4G的内存,堆给了2G
每次YGC,eden在做自行调整,但是老年代还是没有及时清除,堆看着都满了 下面图中已标红
增大一下GCPauseMillis时间,可以缩短GC的频率。减小一下年轻代大小
最后优化一下参数为
最终FullGC消失,只有YoungGC 和 MixGC