年轻一代GC在EXT Root Scanning上花费了太多时间

时间:2018-02-25 12:48:47

标签: java garbage-collection jvm g1gc

我有一个Java应用程序在G1 Gc上花费了大量时间,特别是在年轻人身上。

[Ext Root Scanning(ms):Min:10.4,Avg:21.4,Max:137.2,Diff:126.8,Sum:385.2]

花费大量时间进行Ext Root Scanning。我无法弄清楚为什么这样做。什么是调试这个的好方法?任何帮助表示赞赏。

我之前已经读过,当代码缓存变大时会发生这种情况。代码高速缓存大小约为90 MB。我有几个节点运行相同的应用程序,它们具有更高的代码缓存大小,并且在年轻的gc中花费的时间明显更少。

我的Java版本:

java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

我们使用的标志:

-XX:+AlwaysPreTouch -XX:G1HeapRegionSize=8388608 -XX:GCLogFileSize=26214400 
-XX:+HeapDumpOnOutOfMemoryError -XX:InitialHeapSize=17179869184 -XX:+ManagementServer 
-XX:MaxGCPauseMillis=40 -XX:MaxHeapSize=17179869184 -XX:NumberOfGCLogFiles=40 
-XX:+ParallelRefProcEnabled -XX:+PrintAdaptiveSizePolicy -XX:+PrintCommandLineFlags 
-XX:+PrintGC -XX:+PrintGCApplicationStoppedTime 
-XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintTenuringDistribution -XX:+UnlockExperimentalVMOptions 
-XX:+UseCompressedClassPointers -XX:+UseCompressedOops 
-XX:+UseG1GC -XX:+UseGCLogFileRotation

以下是GC Log的示例。

2018-02-25T10:26:27.325+0000: 252536.066: [GC pause (GCLocker Initiated GC) (young)
Desired survivor size 54525952 bytes, new threshold 15 (max 15)
- age   1:    4584256 bytes,    4584256 total
- age   2:     507616 bytes,    5091872 total
- age   3:     522784 bytes,    5614656 total
- age   4:    1195744 bytes,    6810400 total
- age   5:     884192 bytes,    7694592 total
- age   6:    2016552 bytes,    9711144 total
- age   7:     778576 bytes,   10489720 total
- age   8:    3066312 bytes,   13556032 total
- age   9:     584736 bytes,   14140768 total
- age  10:     297152 bytes,   14437920 total
- age  11:     709296 bytes,   15147216 total
- age  12:     608328 bytes,   15755544 total
- age  13:     609584 bytes,   16365128 total
- age  14:     637952 bytes,   17003080 total
- age  15:    2049208 bytes,   19052288 total
 252536.068: [G1Ergonomics (CSet Construction) start choosing CSet, _pending_cards: 6415, predicted base time: 64.92 ms, remaining time: 0.00 ms, target pause time: 40.00 ms]
 252536.068: [G1Ergonomics (CSet Construction) add young regions to CSet, eden: 95 regions, survivors: 8 regions, predicted young region time: 68.43 ms]
 252536.068: [G1Ergonomics (CSet Construction) finish choosing CSet, eden: 95 regions, survivors: 8 regions, old: 0 regions, predicted pause time: 133.35 ms, target pause time: 40.00 ms]
, 0.1635855 secs]
   [Parallel Time: 139.4 ms, GC Workers: 18]
      [GC Worker Start (ms): Min: 252536073.2, Avg: 252536073.8, Max: 252536074.4, Diff: 1.3]
      [Ext Root Scanning (ms): Min: 10.4, Avg: 21.4, Max: 137.2, Diff: 126.8, Sum: 385.2]
      [Update RS (ms): Min: 0.0, Avg: 18.6, Max: 28.5, Diff: 28.5, Sum: 335.3]
         [Processed Buffers: Min: 0, Avg: 63.7, Max: 91, Diff: 91, Sum: 1147]
      [Scan RS (ms): Min: 0.0, Avg: 18.3, Max: 23.7, Diff: 23.7, Sum: 329.4]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [Object Copy (ms): Min: 0.4, Avg: 60.4, Max: 64.8, Diff: 64.4, Sum: 1088.1]
      [Termination (ms): Min: 0.0, Avg: 19.5, Max: 20.9, Diff: 20.9, Sum: 350.3]
      [GC Worker Other (ms): Min: 0.1, Avg: 0.3, Max: 0.5, Diff: 0.4, Sum: 4.8]
      [GC Worker Total (ms): Min: 137.8, Avg: 138.5, Max: 139.1, Diff: 1.3, Sum: 2493.0]
      [GC Worker End (ms): Min: 252536212.2, Avg: 252536212.3, Max: 252536212.4, Diff: 0.3]
   [Code Root Fixup: 0.8 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 7.9 ms]
   [Other: 15.5 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 2.7 ms]
      [Ref Enq: 0.1 ms]
      [Redirty Cards: 0.3 ms]
      [Humongous Reclaim: 0.0 ms]
      [Free CSet: 1.8 ms]
   [Eden: 760.0M(752.0M)->0.0B(776.0M) Survivors: 64.0M->40.0M Heap: 7861.5M(16.0G)->7084.8M(16.0G)]
 [Times: user=2.55 sys=0.02, real=0.17 secs] 

0 个答案:

没有答案