求助>G1 FullGC 时间比较长>
4回复
4周前

G1 FullGC 时间比较长



想缩减gc时间,还有救么?

启动参数
java -Xmx5000m -Xmn2500m -XX:+UseG1GC -XX:-UseParallelGC -XX:-UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps

日志如下:


2021-07-03T11:33:38.366+0800: 196849.404: [GC pause (G1 Evacuation Pause) (young), 0.0080592 secs]
   [Parallel Time: 5.6 ms, GC Workers: 4]
      [GC Worker Start (ms): Min: 196849404.5, Avg: 196849404.6, Max: 196849405.0, Diff: 0.6]
      [Ext Root Scanning (ms): Min: 2.3, Avg: 3.0, Max: 4.8, Diff: 2.5, Sum: 11.9]
      [Update RS (ms): Min: 0.0, Avg: 1.9, Max: 2.8, Diff: 2.8, Sum: 7.8]
         [Processed Buffers: Min: 0, Avg: 5.2, Max: 10, Diff: 10, Sum: 21]
      [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: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.1, Sum: 0.4]
      [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 0.5]
         [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: 4.9, Avg: 5.4, Max: 5.5, Diff: 0.6, Sum: 21.4]
      [GC Worker End (ms): Min: 196849410.0, Avg: 196849410.0, Max: 196849410.0, Diff: 0.0]
   [Code Root Fixup: 0.3 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.1 ms]
   [Other: 2.1 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 1.1 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.1 ms]
      [Humongous Register: 0.2 ms]
      [Humongous Reclaim: 0.2 ms]
      [Free CSet: 0.1 ms]
   [Eden: 0.0B(2500.0M)->0.0B(2500.0M) Survivors: 0.0B->0.0B Heap: 4989.0M(5000.0M)->4989.0M(5000.0M)]
 [Times: user=0.02 sys=0.00, real=0.01 secs] 
2021-07-03T11:33:38.377+0800: 196849.415: [Full GC (Allocation Failure)  4989M->1518M(5000M), 5.7315737 secs]
   [Eden: 0.0B(2500.0M)->0.0B(2500.0M) Survivors: 0.0B->0.0B Heap: 4989.0M(5000.0M)->1518.4M(5000.0M)], [Metaspace: 59683K->59595K(1103872K)]
 [Times: user=8.54 sys=0.00, real=5.73 secs] 
2021-07-03T11:33:44.109+0800: 196855.147: [GC concurrent-mark-abort]
2021-07-03T11:34:16.275+0800: 196887.313: [GC pause (G1 Evacuation Pause) (young), 0.0853724 secs]
   [Parallel Time: 70.3 ms, GC Workers: 4]
      [GC Worker Start (ms): Min: 196887316.5, Avg: 196887316.6, Max: 196887316.6, Diff: 0.1]
      [Ext Root Scanning (ms): Min: 1.6, Avg: 1.8, Max: 2.4, Diff: 0.8, Sum: 7.3]
      [Update RS (ms): Min: 30.9, Avg: 31.4, Max: 31.6, Diff: 0.8, Sum: 125.4]
         [Processed Buffers: Min: 68, Avg: 72.0, Max: 75, Diff: 7, Sum: 288]
      [Scan RS (ms): Min: 17.0, Avg: 17.2, Max: 17.4, Diff: 0.4, Sum: 68.7]
      [Code Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.2, Diff: 0.1, Sum: 0.7]
      [Object Copy (ms): Min: 19.5, Avg: 19.5, Max: 19.6, Diff: 0.2, Sum: 78.0]
      [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: 4]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.4]
      [GC Worker Total (ms): Min: 70.1, Avg: 70.2, Max: 70.2, Diff: 0.1, Sum: 280.6]
      [GC Worker End (ms): Min: 196887386.7, Avg: 196887386.7, Max: 196887386.8, Diff: 0.1]
   [Code Root Fixup: 0.1 ms]
   [Code Root Purge: 0.1 ms]
   [Clear CT: 1.2 ms]
   [Other: 13.6 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 0.5 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.3 ms]
      [Humongous Register: 0.5 ms]
      [Humongous Reclaim: 1.2 ms]
      [Free CSet: 7.9 ms]
   [Eden: 2500.0M(2500.0M)->0.0B(2484.0M) Survivors: 0.0B->16.0M Heap: 4394.5M(5000.0M)->1533.6M(5000.0M)]
 [Times: user=0.31 sys=0.00, real=0.09 secs] 
1006 阅读
请先登录,再评论

回复列表

Zoro_6296793小时前

未设置-XX:MaxGCPauseMillis这个参数吧

李家智4天前

整体内存分小点,GC时间就短吧,或者试试把old区分陪配置小点

可以做以下尝试:1.提前触发并发标记、然后及早进行混合回收 2.看看是否新生在运行时是否合理,是否需要调整对象晋升的阈值

https://a.perfma.net/img/2382850
鸠摩4周前

需要先找到慢的原因。在发生FGC时,Eden区中的对象实例大小为0?是YGC频繁都过早晋升到老年代了吗?还是都是大对象?老年代中大部分(4989-1518)都是垃圾