求助>G1 Humongous Allocation>
12回复
2周前

G1 Humongous Allocation



大对象分配非常频繁
1、initial-mark (G1 Humongous Allocation) (young)
2、并发标记阶段 [GC concurrent]
其中,cleanup 每次都不回收
[GC cleanup 5103M->5103M(7372M), 0.0280975 secs]
3、mixed (只触发一次)

4、又开始新一轮 1、2、3 …
求助:
1、为什么clean up完全不回收
2、并发标记阶段之后,mixed为什么只触发一次
3、如何追踪这些大对象是什么
非常感谢!

2074 阅读
请先登录,再评论

回复列表

sofkyle2周前

从你的GC日志来看,并没有出现如你所描述的问题

sofkyle2周前
回复沉淀、:

你可以看下官方文档,这里面有描述什么时候进行Mixed GC,简单说来就是:默认情况下,堆使用超过45%,就会触发。

https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc_tuning.html#default_g1_gc

回复
沉淀、2周前
回复sofkyle:

😁 好的。dump文件太大了,不好上传啊,我在本地用MAT分析过,没有很多大于1/2 region的对象,而且都没有引用了,看不出来是啥,还是想找出来到底是哪些对象,从代码上去修复,手动改region size有点治标不治本。还请帮忙多拉几个大牛过来看看呀~

回复
sofkyle2周前
回复沉淀、:

至于mixed gc的问题,就要等别的大牛来回答你了

回复
查看更多
言风2周前

建议你把环境信息补充一下,比如jvm参数,gc日志,jdk版本。
社区版的内存dump是可以查看大对象分布的

沉淀、2周前
回复言风:
GC 日志:initial-mark -> concurrent phase -> mixed gc -> initial-mark ...开始新一轮循环,
2019-11-18T15:08:11.941+0800: 1547378.651: [GC pause (G1 Humongous Allocation) (young) (initial-mark), 0.0363498 secs]
   [Parallel Time: 35.0 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 1547378651.9, Avg: 1547378651.9, Max: 1547378652.0, Diff: 0.1]
      [Ext Root Scanning (ms): Min: 1.6, Avg: 1.8, Max: 1.9, Diff: 0.3, Sum: 14.3]
      [Update RS (ms): Min: 18.3, Avg: 18.4, Max: 18.6, Diff: 0.3, Sum: 147.4]
         [Processed Buffers: Min: 35, Avg: 47.8, Max: 68, Diff: 33, Sum: 382]
      [Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.4]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
      [Object Copy (ms): Min: 14.2, Avg: 14.4, Max: 14.5, Diff: 0.3, Sum: 115.3]
      [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.2]
         [Termination Attempts: Min: 10, Avg: 15.8, Max: 19, Diff: 9, Sum: 126]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [GC Worker Total (ms): Min: 34.7, Avg: 34.7, Max: 34.8, Diff: 0.1, Sum: 277.8]
      [GC Worker End (ms): Min: 1547378686.7, Avg: 1547378686.7, Max: 1547378686.7, Diff: 0.0]
   [Code Root Fixup: 0.0 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.1 ms]
   [Other: 1.2 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 0.1 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.1 ms]
      [Humongous Register: 0.0 ms]
      [Humongous Reclaim: 0.1 ms]
      [Free CSet: 0.2 ms]
   [Eden: 140.0M(1980.0M)->0.0B(1916.0M) Survivors: 28.0M->52.0M Heap: 4617.9M(7372.0M)->4500.5M(7372.0M)]
 [Times: user=0.28 sys=0.00, real=0.03 secs] 
2019-11-18T15:08:11.978+0800: 1547378.688: [GC concurrent-root-region-scan-start]
2019-11-18T15:08:11.989+0800: 1547378.699: [GC concurrent-root-region-scan-end, 0.0114634 secs]
2019-11-18T15:08:11.989+0800: 1547378.699: [GC concurrent-mark-start]
2019-11-18T15:08:13.193+0800: 1547379.904: [GC concurrent-mark-end, 1.2040660 secs]
2019-11-18T15:08:13.196+0800: 1547379.906: [GC remark 2019-11-18T15:08:13.196+0800: 1547379.906: [Finalize Marking, 0.0005519 secs] 2019-11-18T15:08:13.196+0800: 1547379.906: [GC ref-proc, 0.0009851 secs] 2019-11-18T15:08:13.197+0800: 1547379.907: [Unloading, 0.0110541 secs], 0.0227657 secs]
 [Times: user=0.17 sys=0.00, real=0.02 secs] 
2019-11-18T15:08:13.221+0800: 1547379.931: [GC cleanup 5254M->5254M(7372M), 0.0256680 secs]
 [Times: user=0.20 sys=0.00, real=0.02 secs] 
2019-11-18T15:08:16.272+0800: 1547382.982: [GC pause (G1 Evacuation Pause) (young), 0.0337445 secs]
   [Parallel Time: 31.7 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 1547382982.2, Avg: 1547382982.2, Max: 1547382982.3, Diff: 0.1]
      [Ext Root Scanning (ms): Min: 0.8, Avg: 1.0, Max: 1.5, Diff: 0.7, Sum: 7.7]
      [Update RS (ms): Min: 10.1, Avg: 10.6, Max: 11.0, Diff: 0.9, Sum: 84.7]
         [Processed Buffers: Min: 46, Avg: 62.1, Max: 74, Diff: 28, Sum: 497]
      [Scan RS (ms): Min: 0.0, Avg: 0.2, Max: 0.3, Diff: 0.3, Sum: 1.7]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
      [Object Copy (ms): Min: 19.5, Avg: 19.6, Max: 19.7, Diff: 0.1, Sum: 156.9]
      [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
         [Termination Attempts: Min: 1, Avg: 74.5, Max: 106, Diff: 105, Sum: 596]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.4]
      [GC Worker Total (ms): Min: 31.5, Avg: 31.5, Max: 31.5, Diff: 0.1, Sum: 252.0]
      [GC Worker End (ms): Min: 1547383013.7, Avg: 1547383013.7, Max: 1547383013.8, Diff: 0.1]
   [Code Root Fixup: 0.0 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.3 ms]
   [Other: 1.8 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 0.2 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.1 ms]
      [Humongous Register: 0.1 ms]
      [Humongous Reclaim: 0.2 ms]
      [Free CSet: 0.6 ms]
   [Eden: 1916.0M(1916.0M)->0.0B(304.0M) Survivors: 52.0M->64.0M Heap: 6552.8M(7372.0M)->4512.5M(7372.0M)]
 [Times: user=0.26 sys=0.00, real=0.03 secs] 
2019-11-18T15:08:16.569+0800: 1547383.279: [GC pause (G1 Evacuation Pause) (mixed), 0.0383045 secs]
   [Parallel Time: 36.6 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 1547383279.5, Avg: 1547383279.5, Max: 1547383279.6, Diff: 0.1]
      [Ext Root Scanning (ms): Min: 0.8, Avg: 0.9, Max: 1.3, Diff: 0.6, Sum: 7.5]
      [Update RS (ms): Min: 4.8, Avg: 5.0, Max: 5.2, Diff: 0.4, Sum: 40.3]
         [Processed Buffers: Min: 22, Avg: 31.4, Max: 51, Diff: 29, Sum: 251]
      [Scan RS (ms): Min: 1.6, Avg: 1.8, Max: 2.0, Diff: 0.5, Sum: 14.6]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
      [Object Copy (ms): Min: 28.6, Avg: 28.6, Max: 28.7, Diff: 0.1, Sum: 229.1]
      [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
         [Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 8]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [GC Worker Total (ms): Min: 36.4, Avg: 36.5, Max: 36.5, Diff: 0.1, Sum: 291.8]
      [GC Worker End (ms): Min: 1547383316.0, Avg: 1547383316.0, Max: 1547383316.0, Diff: 0.0]
   [Code Root Fixup: 0.0 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.3 ms]
   [Other: 1.4 ms]
      [Choose CSet: 0.1 ms]
      [Ref Proc: 0.1 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.3 ms]
      [Humongous Register: 0.1 ms]
      [Humongous Reclaim: 0.1 ms]
      [Free CSet: 0.3 ms]
   [Eden: 304.0M(304.0M)->0.0B(1948.0M) Survivors: 64.0M->28.0M Heap: 4839.2M(7372.0M)->4508.1M(7372.0M)]
 [Times: user=0.30 sys=0.00, real=0.03 secs] 
2019-11-18T15:08:16.767+0800: 1547383.477: [GC pause (G1 Humongous Allocation) (young) (initial-mark), 0.0345251 secs]

回复
沉淀、2周前
回复言风:
JDK版本:1.8.0_201,JVM 参数:
-Xmx12288m -Xms7372m -Xss256k -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m 
-XX:MaxGCPauseMillis=200 -XX:+UseG1GC -XX:ParallelGCThreads=8 -XX:ConcGCThreads=8 -XX:-OmitStackTraceInFastThrow -XX:MinHeapFreeRatio=30 -XX:MaxHeapFreeRatio=50 
-XX:+PreserveFramePointer -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=32M 
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/logs -Dport.http.server=8080 -Dlog.server=/opt/logs -Dport.shutdown.server=8081 -Ddocbase.server=/opt/app 
-Djava.util.concurrent.ForkJoinPool.common.parallelism=8 -XX:CICompilerCount=4  -Dvdir.server= -Djava.security.egd=file:/dev/./urandom 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8780 -Dcom.sun.management.jmxremote.rmi.port=8780 
-Dcom.sun.management.jmxremote.local.only=false -Xloggc:/opt/logs/gc.log -DAPPLOGDIR=/opt/logs/applog 
回复