初始内存配置:-Xmx80g -Xmn70g
首次GC较久500ms,然后保持每次300ms的GC时间,内存涨得很快。S0大小为0,S1为640M左右。每次gc只会保留S1区域数据,其它区域为空,偶尔old区会有数据。

后把Xmn干掉,加上-XX:MaxGCPauseMillis=200
刚开始GC很频繁,内存缓慢上升,随着访问量的上涨,内存涨到一定的值后不涨,gc时间在150ms到200ms之间。S0同样大小为0,S1为400M左右,每次gc后old区会有小幅(几个M)上涨。

一、指定Xmn70g时的内存及GC情况
[code]
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
0.0 655360.0 0.0 655360.0 76414976.0 7733248.0 6815744.0 13.0 131072.0 90742.6 3 1.194 0 0.000 1.194
[/code]

GC明细日志
[code]
2017-02-24T10:30:07.003+0800: 1840.578: [GC pause (young), 0.3317730 secs]
[Parallel Time: 144.1 ms, GC Workers: 18]
[GC Worker Start (ms): Min: 1840578.5, Avg: 1840578.8, Max: 1840579.1, Diff: 0.6]
[Ext Root Scanning (ms): Min: 3.5, Avg: 4.6, Max: 5.3, Diff: 1.8, Sum: 83.1]
[Update RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Processed Buffers: Min: 0, Avg: 0.7, Max: 13, Diff: 13, Sum: 13]
[Scan RS (ms): Min: 0.2, Avg: 0.8, Max: 1.9, Diff: 1.6, Sum: 13.5]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.5, Max: 1.6, Diff: 1.6, Sum: 9.3]
[Object Copy (ms): Min: 135.8, Avg: 137.3, Max: 138.1, Diff: 2.4, Sum: 2471.9]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.9]
[GC Worker Other (ms): Min: 0.0, Avg: 0.2, Max: 0.3, Diff: 0.2, Sum: 2.8]
[GC Worker Total (ms): Min: 143.1, Avg: 143.5, Max: 143.9, Diff: 0.8, Sum: 2582.5]
[GC Worker End (ms): Min: 1840722.2, Avg: 1840722.3, Max: 1840722.4, Diff: 0.2]
[Code Root Fixup: 4.6 ms]
[Code Root Migration: 58.9 ms]
[Clear CT: 9.2 ms]
[Other: 115.0 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 101.5 ms]
[Ref Enq: 3.5 ms]
[Free CSet: 9.2 ms]
[Eden: 69.4G(69.4G)->0.0B(69.4G) Survivors: 640.0M->640.0M Heap: 70.0G(80.0G)->640.0M(80.0G)]
[Times: user=2.92 sys=0.00, real=0.33 secs]
2017-02-24T10:33:02.810+0800: 2016.385: [GC pause (young), 0.3121140 secs]
[Parallel Time: 131.7 ms, GC Workers: 18]
[GC Worker Start (ms): Min: 2016385.6, Avg: 2016385.8, Max: 2016386.0, Diff: 0.5]
[Ext Root Scanning (ms): Min: 3.5, Avg: 4.5, Max: 5.3, Diff: 1.8, Sum: 81.6]
[Update RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Processed Buffers: Min: 0, Avg: 0.8, Max: 14, Diff: 14, Sum: 14]
[Scan RS (ms): Min: 0.2, Avg: 0.8, Max: 1.9, Diff: 1.7, Sum: 13.7]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.5, Max: 1.1, Diff: 1.1, Sum: 8.5]
[Object Copy (ms): Min: 123.8, Avg: 125.1, Max: 126.0, Diff: 2.2, Sum: 2252.5]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 1.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.2, Max: 0.3, Diff: 0.2, Sum: 2.8]
[GC Worker Total (ms): Min: 130.9, Avg: 131.1, Max: 131.5, Diff: 0.6, Sum: 2360.5]
[GC Worker End (ms): Min: 2016516.8, Avg: 2016516.9, Max: 2016517.1, Diff: 0.2]
[Code Root Fixup: 4.4 ms]
[Code Root Migration: 59.6 ms]
[Clear CT: 9.0 ms]
[Other: 107.5 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 94.1 ms]
[Ref Enq: 3.2 ms]
[Free CSet: 9.3 ms]
[Eden: 69.4G(69.4G)->0.0B(69.4G) Survivors: 640.0M->640.0M Heap: 70.0G(80.0G)->640.0M(80.0G)]
[Times: user=2.68 sys=0.00, real=0.31 secs]
[/code]

二、去掉Xmn后,指定-XX:MaxGCPauseMillis=200后
内存使用
[code]
jstat -gcutil 24916 1000
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 100.00 84.87 2.33 67.95 43 5.938 0 0.000 5.938

jstat -gc 24916 1000
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
0.0 458752.0 0.0 458752.0 52396032.0 10551296.0 31031296.0 711882.3 131072.0 89059.2 44 6.109 0 0.000 6.109
[/code]

[code]
2017-02-24T11:48:21.988+0800: 3645.601: [GC pause (young), 0.1703250 secs]
[Parallel Time: 87.6 ms, GC Workers: 18]
[GC Worker Start (ms): Min: 3645602.3, Avg: 3645602.6, Max: 3645602.9, Diff: 0.6]
[Ext Root Scanning (ms): Min: 4.7, Avg: 6.3, Max: 7.1, Diff: 2.5, Sum: 113.9]
[Update RS (ms): Min: 2.0, Avg: 2.7, Max: 4.0, Diff: 2.0, Sum: 49.2]
[Processed Buffers: Min: 12, Avg: 31.3, Max: 53, Diff: 41, Sum: 564]
[Scan RS (ms): Min: 0.9, Avg: 1.0, Max: 1.1, Diff: 0.2, Sum: 18.3]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.3]
[Object Copy (ms): Min: 76.3, Avg: 76.7, Max: 77.5, Diff: 1.1, Sum: 1380.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.9]
[GC Worker Other (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.3, Sum: 3.4]
[GC Worker Total (ms): Min: 86.6, Avg: 87.0, Max: 87.4, Diff: 0.8, Sum: 1566.3]
[GC Worker End (ms): Min: 3645689.5, Avg: 3645689.6, Max: 3645689.8, Diff: 0.3]
[Code Root Fixup: 0.5 ms]
[Code Root Migration: 0.3 ms]
[Clear CT: 6.1 ms]
[Other: 75.7 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 66.4 ms]
[Ref Enq: 2.3 ms]
[Free CSet: 5.4 ms]
[Eden: 47.6G(47.6G)->0.0B(47.6G) Survivors: 416.0M->448.0M Heap: 48.7G(80.0G)->1143.2M(80.0G)]
[Times: user=1.74 sys=0.00, real=0.17 secs]
2017-02-24T11:50:20.519+0800: 3764.132: [GC pause (young), 0.1480790 secs]
[Parallel Time: 70.2 ms, GC Workers: 18]
[GC Worker Start (ms): Min: 3764132.9, Avg: 3764133.1, Max: 3764133.2, Diff: 0.4]
[Ext Root Scanning (ms): Min: 5.3, Avg: 6.2, Max: 6.5, Diff: 1.2, Sum: 111.4]
[Update RS (ms): Min: 2.4, Avg: 2.7, Max: 3.5, Diff: 1.1, Sum: 48.5]
[Processed Buffers: Min: 9, Avg: 30.6, Max: 56, Diff: 47, Sum: 551]
[Scan RS (ms): Min: 1.0, Avg: 1.0, Max: 1.1, Diff: 0.1, Sum: 18.3]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.3]
[Object Copy (ms): Min: 59.4, Avg: 59.6, Max: 60.2, Diff: 0.9, Sum: 1073.5]
[Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.3]
[GC Worker Other (ms): Min: 0.0, Avg: 0.2, Max: 0.3, Diff: 0.2, Sum: 2.7]
[GC Worker Total (ms): Min: 69.6, Avg: 69.7, Max: 69.9, Diff: 0.3, Sum: 1255.0]
[GC Worker End (ms): Min: 3764202.7, Avg: 3764202.8, Max: 3764202.9, Diff: 0.2]
[Code Root Fixup: 0.6 ms]
[Code Root Migration: 0.4 ms]
[Clear CT: 6.1 ms]
[Other: 70.8 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 60.5 ms]
[Ref Enq: 2.1 ms]
[Free CSet: 6.2 ms]
[Eden: 47.6G(47.6G)->0.0B(47.6G) Survivors: 448.0M->448.0M Heap: 48.7G(80.0G)->1162.9M(80.0G)]
[Times: user=1.42 sys=0.00, real=0.15 secs]
[/code]

标签: g1, Java

添加新评论