SlideShare une entreprise Scribd logo
1  sur  99
Java 9 - The (G1) GC
Awakens
QCon London 2016
1
Monica Beckwith
monica@codekaram.com; @mon_beck
https://www.linkedin.com/in/monicabeckwith
www.codekaram.com
©2016 CodeKaram
A long time ago in a galaxy (not so) far,
far away….
2
©2016 CodeKaram
Garbage First
Garbage Collector
3
©2016 CodeKaram4
©2016 CodeKaram
About Me
• Java/JVM/GC Performance Consultant
• Have worked with HotSpot for more than a
decade.
• Was the performance lead for G1 GC @Oracle.
5
©2016 CodeKaram
Agenda
• Heap Regions
• Additional Data Structures
• CSet & RSets
• Young Collection
• Marking Threshold & Concurrent Marking Stages
• Mixed Collection
• Evacuation Failures
• Fragmentation
• Humongous Objects
• Tuneables
6
G1 GC Heap Regions
7
©2016 CodeKaram
Heap Regions
8
Contiguous Java Heap
Free
Region
Non-Free
Region
©2016 CodeKaram
• Heap region size = heap size/2048
• can range from 1 MB to 32 MB
• is a power of 2
• is aligned
9
Heap Regions
©2016 CodeKaram
Eden
Old Old
Eden
Old
Survivor
Humongous
10
Heap Regions
©2016 CodeKaram
• Young Regions - Regions that house objects in
the Eden and Survivor Spaces
• Old Regions - Regions that house objects in the
Old generation.
• Humongous Regions - Regions that house
Humongous Objects.
11
Heap Regions
Additional Data
Structures
12
©2016 CodeKaram
G1 GC Collection Set &
Remembered Sets
• Additional data structure to help with
maintenance and collection
• Add a slight footprint overhead (~5%)
13
Collection Set
14
©2016 CodeKaram
Collection Set
• A young collection set (CSet) will incorporate all
the young regions
• A mixed collection set will incorporate all the
young regions and a few candidate old regions
based on the “most garbage first” principle.
15
©2016 CodeKaram
Eden
Old Old
Eden
Old
Surv
ivor
CSet during a young collection -
16
Collection Set
©2016 CodeKaram
Old Old
Old
CSet during a mixed collection -
Sur
viv
or
Ol
d
Eden Eden
17
Collection Set
©2016 CodeKaram
• G1MixedGCLiveThresholdPercent
18
Enable UnlockExperimentalVMOptions
Collection Set
©2016 CodeKaram
• G1OldCSetRegionThresholdPercent
19
Enable UnlockExperimentalVMOptions
Collection Set
©2016 CodeKaram20
[86.548s][debug][gc,ergo,cset] GC(71) Finish adding old
regions to CSet (reclaimable percentage not over threshold).
old 13 regions, max 68 regions, reclaimable: 35485144B
(4.98%) threshold: 5%
Log Output with -
Xlog:gc*,ergo*=trace
• G1OldCSetRegionThresholdPercent
Remembered Sets
21
©2016 CodeKaram
• Maintains and tracks incoming references into its
region
• old-to-young references
• old-to-old references
• Remembered sets have varying granularity
based on the “popularity” of objects or regions.
22
Remembered Sets
Quick Info: The next few figures and
log outputs are from chapters 2 and 3
of the upcoming Java Performance
Companion and will be marked with **.
23
©2016 CodeKaram24
Figure 2.3 Remembered sets with incoming object references**
©2016 CodeKaram
Remembered Sets
• Different granularities:
• sparse per-region-table (PRT)
• fine-grained PRT
• coarse-grained bitmap
25
©2016 CodeKaram26
Recent concurrent refinement statistics
Processed 23270 cards
Of 96 completed buffers:
96 (100.0%) by concurrent RS threads.
0 ( 0.0%) by mutator threads
Did 0 coarsenings.
** -XX:+UnlockDiagnosticVMOptions -
XX:G1SummarizeRSetStatsPeriod=1
Log Output with -Xlog:gc
+remset=trace
A Young Collection
27
©2016 CodeKaram
G1 GC Heap
Eden
Old Old
Eden
Old
Surv
ivor
28
©2016 CodeKaram
During a Young Collection
Eden
Old Old
Eden
Old
Surv
ivor
29
©2016 CodeKaram
After a Young Collection
Old Old
Old
Sur
viv
or
Ol
d
30
A Young Collection Log
Snippet with -Xlog:gc*,gc
+phases=debug
31
©2016 CodeKaram32
[10.578s][info ][gc,start ] GC(20) Pause Mixed (G1 Evacuation Pause) (10.578s)
[10.603s][debug ][gc,phases ] GC(20) Parallel Time: 24.1 ms
[10.603s][debug ][gc,phases ] GC(20) GC Worker Start: Min: 10578.1, Avg: 10578.1, Max: 10578.1, Diff: 0.0
[10.603s][debug ][gc,phases ] GC(20) Ext Root Scanning: Min: 0.2, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.9
[10.603s][debug ][gc,phases ] GC(20) Thread Roots: Min: 0.0, Avg: 0.1, Max: 0.3, Diff: 0.3, Sum: 0.6
[10.603s][debug ][gc,phases ] GC(20) StringTable Roots: Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.1
[10.603s][debug ][gc,phases ] GC(20) Universe Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) JNI Handles Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) ObjectSynchronizer Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) FlatProfiler Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) Management Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) SystemDictionary Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) CLDG Roots: Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.2
[10.603s][debug ][gc,phases ] GC(20) JVMTI Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) CM RefProcessor Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) Wait For Strong CLD: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) Weak CLD Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) SATB Filtering: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) Update RS: Min: 3.9, Avg: 4.0, Max: 4.2, Diff: 0.3, Sum: 32.3
[10.603s][debug ][gc,phases ] GC(20) Processed Buffers: Min: 5, Avg: 6.2, Max: 8, Diff: 3, Sum: 50
[10.603s][debug ][gc,phases ] GC(20) Scan HCC: Min: 0.4, Avg: 0.5, Max: 0.5, Diff: 0.1, Sum: 3.8
[10.603s][debug ][gc,phases ] GC(20) Scan RS: Min: 6.0, Avg: 10.4, Max: 11.2, Diff: 5.2, Sum: 82.9
[10.603s][debug ][gc,phases ] GC(20) Code Root Scanning: Min: 0.0, Avg: 0.7, Max: 5.2, Diff: 5.2, Sum: 5.3
[10.603s][debug ][gc,phases ] GC(20) Object Copy: Min: 8.6, Avg: 8.7, Max: 8.8, Diff: 0.2, Sum: 69.4
[10.603s][debug ][gc,phases ] GC(20) Termination: Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.7
[10.603s][debug ][gc,phases ] GC(20) Termination Attempts: Min: 1, Avg: 12.2, Max: 16, Diff: 15, Sum: 98
[10.603s][debug ][gc,phases ] GC(20) GC Worker Other: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0
[10.603s][debug ][gc,phases ] GC(20) GC Worker Total: Min: 24.0, Avg: 24.1, Max: 24.1, Diff: 0.0, Sum: 192.5
[10.603s][debug ][gc,phases ] GC(20) GC Worker End: Min: 10602.2, Avg: 10602.2, Max: 10602.2, Diff: 0.0
Young Collection
©2016 CodeKaram33
[10.603s][debug ][gc,phases ] GC(20) Code Root Fixup: 0.1 ms
[10.603s][debug ][gc,phases ] GC(20) Code Root Purge: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Clear CT: 0.1 ms
[10.603s][debug ][gc,phases ] GC(20) Expand Heap After Collection: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Other: 0.7 ms
[10.603s][debug ][gc,phases ] GC(20) Choose CSet: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Ref Proc: 0.1 ms
[10.603s][debug ][gc,phases ] GC(20) Ref Enq: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Redirty Cards: 0.1 ms
[10.603s][debug ][gc,phases ] GC(20) Parallel Redirty: Min: 0.1, Avg: 0.1, Max:
0.1, Diff: 0.0, Sum: 0.8
[10.603s][debug ][gc,phases ] GC(20) Redirtied Cards: Min: 7563, Avg: 8703.4, Max:
10349, Diff: 2786, Sum: 69627
[10.603s][debug ][gc,phases ] GC(20) Humongous Register: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Humongous Reclaim: 0.0 ms
[10.603s][debug ][gc,phases ] GC(20) Free CSet: 0.3 ms
[10.603s][info ][gc,heap ] GC(20) Eden regions: 14->0(164)
[10.603s][info ][gc,heap ] GC(20) Survivor regions: 11->1(4)
[10.603s][info ][gc,heap ] GC(20) Old regions: 202->203
[10.603s][info ][gc,heap ] GC(20) Humongous regions: 6->6
[10.603s][info ][gc,metaspace] GC(20) Metaspace: 9996K->9996K(1058816K)
[10.603s][info ][gc ] GC(20) Pause Mixed (G1 Evacuation Pause) 232M->209M(500M) (10.578s,
10.603s) 25.329ms
[10.603s][info ][gc,cpu ] GC(20) User=0.19s Sys=0.00s Real=0.03s
Young Collection
A Young Collection Log
Snippet with -XX:
+PrintGCDetails
34
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)-
>379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
35
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
36
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
37
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
38
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
39
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
40
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
41
Young Collection
©2016 CodeKaram
154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs]
[Parallel Time: 253.2 ms, GC Workers: 8]
[GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4]
[Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2]
[Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28]
[Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4]
[Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
[GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7]
[GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.7 ms]
[Other: 4.4 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.3 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.3 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 3.2 ms]
[Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)]
[Times: user=1.72 sys=0.14, real=0.26 secs]
42
Young Collection
©2016 CodeKaram43
Marking Threshold
44
©2016 CodeKaram
Initiating Heap Occupancy
Percent
45
• Threshold to start the concurrent marking cycle
to identify candidate old regions.
• When old generation occupancy crosses this
adaptive threshold.
• Based on the total heap size.
The Concurrent
Marking Stages
46
©2016 CodeKaram
Concurrent Marking - Initial
Mark Stage
47
• stop the world, piggy-backed on a young pause
• marks all root objects
©2016 CodeKaram
Concurrent Marking - Root
Region Scanning Stage
48
• works concurrently with the mutators
• survivor regions are root regions
• must complete before the next GC pause
©2016 CodeKaram
Concurrent Marking -
Concurrent Marking Stage
49
• works concurrently with the mutators
• -XX:ConcGCThreads
• pre-write barrier needed
• live data accounting
• XX:+ClassUnloadingWithConcurrentMark
©2016 CodeKaram
Concurrent Marking - Final
Mark Stage
50
• stop the world
• XX:ParallelGCThreads
• traverse any unvisited live objects.
• safely complete live data accounting.
• reference processing
• XX:+ParallelRefProcEnabled
©2016 CodeKaram
Concurrent Marking -
Cleanup Stage
51
• stop the world
• identifying completely free regions
• sorting regions based on “efficiency”
• RSet scrubbing
• concurrent
• reset and return empty region to the free list.
©2016 CodeKaram
G1 GC Heap
Old Old
Old
Sur
viv
or
Ol
d
Eden Eden
Old
52
©2016 CodeKaram
Old Old
Old
Sur
viv
or
Ol
d
Eden Eden
Old
Cleanup Phase
53
©2016 CodeKaram
Old Old
Old
Sur
viv
or
Ol
d
Eden Eden
54
Cleanup Phase
Concurrent Marking
Stages Log Snippet with -
Xlog:gc*,ergo*
55
©2016 CodeKaram56
[9.474s][info][gc,start ] GC(17) Pause Initial Mark (G1 Evacuation Pause) (9.474s)
[9.507s][info][gc,heap ] GC(17) Eden regions: 142->0(143)
[9.507s][info][gc,heap ] GC(17) Survivor regions: 6->11(19)
[9.507s][info][gc,heap ] GC(17) Old regions: 218->218
[9.507s][info][gc,heap ] GC(17) Humongous regions: 30->30
[9.507s][info][gc,metaspace] GC(17) Metaspace: 9976K->9976K(1058816K)
[9.507s][info][gc ] GC(17) Pause Initial Mark (G1 Evacuation Pause) 395M-
>258M(500M) (9.474s, 9.507s) 33.170ms
[9.507s][info][gc,cpu ] GC(17) User=0.20s Sys=0.00s Real=0.03s
[9.507s][info][gc ] GC(18) Concurrent Root Region Scan (9.507s)
[9.534s][info][gc ] GC(18) Concurrent Root Region Scan (9.507s, 9.534s) 26.740ms
[9.534s][info][gc ] GC(18) Concurrent Mark (9.534s)
[9.791s][info][gc ] GC(18) Concurrent Mark (9.534s, 9.791s) 256.961ms
[9.791s][info][gc,start ] GC(18) Pause Remark (9.791s)
[9.794s][info][gc ] GC(18) Pause Remark 269M->269M(500M) (9.791s, 9.794s) 3.008ms
[9.794s][info][gc,cpu ] GC(18) User=0.01s Sys=0.00s Real=0.01s
[9.794s][info][gc,start ] GC(18) Pause Cleanup (9.794s)
[9.795s][info][gc ] GC(18) Pause Cleanup 269M->223M(500M) (9.794s, 9.795s)
1.219ms
[9.795s][info][gc,cpu ] GC(18) User=0.01s Sys=0.00s Real=0.00s
[9.795s][info][gc ] GC(18) Concurrent Cleanup (9.795s)
[9.795s][info][gc ] GC(18) Concurrent Cleanup (9.795s, 9.795s) 0.115ms
Concurrent Marking Stages
Incremental Compaction
aka Mixed Collection
57
©2016 CodeKaram
Old Old
Old
Sur
viv
or
Ol
d
Eden Eden
G1 GC Heap
58
©2016 CodeKaram
Old Old
Old
Sur
viv
or
Ol
d
Eden Eden
During a Mixed Collection
59
©2016 CodeKaram
Old
O
l
d
Sur
vivo
r
Old
After a Mixed Collection
60
A Mixed Collection Log
Snippet with -
Xlog:gc*,ergo*=trace
61
©2016 CodeKaram62
[98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s)
[98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted
base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms
[98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions,
survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is
too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num
not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time:
0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old
region time: 14.78ms, time remaining: 0.00
[98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions
available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5
[98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193)
[98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25)
[98.927s][info ][gc,heap ] GC(40) Old regions: 291->289
[98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14
[98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K)
[98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M)
(98.879s, 98.927s) 47.529ms
[98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s
Mixed GC
©2016 CodeKaram63
[98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s)
[98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms
remaining time: 40.49ms target pause time: 50.00ms
[98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions,
predicted young region time: 76.52ms, target pause time: 50.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high).
predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached
min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time:
14.78ms, time remaining: 0.00
[98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old
regions: 148 reclaimable: 91013912 (8.48) threshold: 5
[98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193)
[98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25)
[98.927s][info ][gc,heap ] GC(40) Old regions: 291->289
[98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14
[98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K)
[98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M-
>309M(1024M) (98.879s, 98.927s) 47.529ms
[98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s
Mixed GC
©2016 CodeKaram64
[98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s)
[98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms
remaining time: 40.49ms target pause time: 50.00ms
[98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179
regions, survivors: 21 regions, predicted young region time: 76.52ms, target
pause time: 50.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high).
predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached
min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time:
14.78ms, time remaining: 0.00
[98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old
regions: 148 reclaimable: 91013912 (8.48) threshold: 5
[98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193)
[98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25)
[98.927s][info ][gc,heap ] GC(40) Old regions: 291->289
[98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14
[98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K)
[98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s)
47.529ms
[98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s
Mixed GC
©2016 CodeKaram65
[98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s)
[98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms
remaining time: 40.49ms target pause time: 50.00ms
[98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions,
predicted young region time: 76.52ms, target pause time: 50.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet
(predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old
22 regions, min 22 regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet
region num not reached min).old: 22 regions, expensive: 22 regions, min: 22
regions, remaining time: 0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions,
predicted old region time: 14.78ms, time remaining: 0.00
[98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old
regions: 148 reclaimable: 91013912 (8.48) threshold: 5
[98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193)
[98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25)
[98.927s][info ][gc,heap ] GC(40) Old regions: 291->289
[98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14
[98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K)
[98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s)
47.529ms
[98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s
Mixed GC
©2016 CodeKaram
• XX:G1MixedGCCountTarget
66
Mixed GC
©2016 CodeKaram67
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old
regions to CSet (predicted time is too high). predicted
time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22
regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive
regions to CSet (old CSet region num not reached min).old:
22 regions, expensive: 22 regions, min: 22 regions,
remaining time: 0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet.
old: 22 regions, predicted old region time: 14.78ms, time
remaining: 0.00
Mixed GC
©2016 CodeKaram68
[239.335s][debug][gc,ergo,cset] GC(145) Finish adding old
regions to CSet (predicted time is too high). predicted
time: 1.23ms, remaining time: 0.83ms old 45 regions, min 16
regions
[239.335s][debug][gc,ergo,cset] GC(145) Finish choosing
CSet. old: 45 regions, predicted old region time: 28.08ms,
time remaining: 0.83
Mixed GC
©2016 CodeKaram
• XX:G1HeapWastePercent
69
Mixed GC
©2016 CodeKaram70
[98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s)
[98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms
remaining time: 40.49ms target pause time: 50.00ms
[98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions,
predicted young region time: 76.52ms, target pause time: 50.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high).
predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions
[98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached
min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms
[98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time:
14.78ms, time remaining: 0.00
[98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions
available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5
[98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193)
[98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25)
[98.927s][info ][gc,heap ] GC(40) Old regions: 291->289
[98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14
[98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K)
[98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s)
47.529ms
[98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s
Mixed GC
©2016 CodeKaram71
Promotion/Evacuation
Failures In The G1
Collector
72
©2016 CodeKaram
Evacuation Failures
73
276.731: [GC pause (G1 Evacuation Pause) (young) (to-space exhausted),
0.8272932 secs]
[Parallel Time: 387.0 ms, GC Workers: 8]
<snip>
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.2 ms]
[Other: 440.0 ms]
[Evacuation Failure: 437.5 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.1 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.9 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 0.9 ms]
[Eden: 831.0M(900.0M)->0.0B(900.0M) Survivors: 0.0B->0.0B Heap: 1020.1M(1024.0M)-
>1020.1M(1024.0M)]
[Times: user=3.64 sys=0.20, real=0.83 secs]
**
©2015 CodeKaram
• When there are no more regions available for
survivors or tenured objects, G1 GC encounters
an evacuation failure.
• An evacuation failure is expensive and the usual
pattern is that if you see a couple of evacuation
failures; full GC could* soon follow.
74
Evacuation Failures
©2015 CodeKaram
A heavily tuned JVM command line
may be restricting the G1 GC
ergonomics and adaptability.
Start with just your heap sizes and a
reasonable pause time goal
75
Avoiding Evacuation
Failures
©2015 CodeKaram
Your live data set + long live
transient data may be too large for
the old generation
Check LDS+ and increase heap to
accommodate everything in the old
generation.
76
Avoiding Evacuation
Failures
©2015 CodeKaram
Initiating Heap Occupancy Threshold
could be the issue.
Check IHOP and make sure it accommodates
the LDS+.
IHOP threshold too high -> Delayed marking ->
Delayed incremental compaction -> Evacuation
Failures!
77
Avoiding Evacuation
Failures
©2015 CodeKaram
Marking Cycle could be taking too
long to complete?
Increase concurrent marking threads
Reduce IHOP
78
Avoiding Evacuation
Failures
©2015 CodeKaram
to-space survivors are the problem?
Increase the G1ReservePercent, if to-space
survivors are triggering the evacuation
failures!
79
Avoiding Evacuation
Failures
©2015 CodeKaram
fragmentation an issue?
80
Avoiding Evacuation
Failures
Fragmentation In The
G1 Collector
81
©2015 CodeKaram
• G1 GC is designed to “absorb” some
fragmentation.
• Default is 5% of the total Java heap
• Tradeoff so that expensive regions are left out.
G1 Heap Waste Percentage
82
©2015 CodeKaram
G1 Mixed GC (Region)
Liveness Threshold
83
• G1 GC’s old regions are also designed to
“absorb” some fragmentation.
• Default is 85% liveness in a G1 region.
• Tradeoff so that expensive regions are left out.
Humongous Objects
84
©2016 CodeKaram
Humongous Objects
85
An old generation region
A young generation region
©2016 CodeKaram
Humongous Objects
86
Object < 50% of
G1 region size
Object >= 50% of
G1 region size
Object > G1
region size
??
©2016 CodeKaram87
Object < 50% of
G1 region size
Humongous Objects
©2016 CodeKaram88
Object >= 50% of
G1 region size
Humongous Objects
©2016 CodeKaram89
Object > G1
region size
Humongous Objects
©2016 CodeKaram90
Object NOT Humongous
Object Humongous
Object Humongous ->
Needs Contiguous Regions
Wasted
Space!
Humongous Objects
©2016 CodeKaram
Ideally, humongous objects are few in
number and are short lived.
A lot of long-lived humongous objects can
cause evacuation failures since humongous
regions add to the old generation occupancy.
91
Humongous Objects
Humongous Allocation
Log Snippet with -
Xlog:gc*,ergo*
92
©2016 CodeKaram93
[161.363s][info][gc,start ] GC(110) Pause Initial Mark (G1
Humongous Allocation) (161.363s)
[161.388s][info][gc,heap ] GC(110) Eden regions: 33-
>0(61)
[161.388s][info][gc,heap ] GC(110) Survivor regions: 14-
>5(13)
[161.388s][info][gc,heap ] GC(110) Old regions: 431->445
[161.388s][info][gc,heap ] GC(110) Humongous regions: 32-
>32
[161.388s][info][gc,metaspace] GC(110) Metaspace: 10422K-
>10422K(1058816K)
[161.388s][info][gc ] GC(110) Pause Initial Mark (G1
Humongous Allocation) 508M->481M(662M) (161.363s, 161.388s)
25.455ms
[161.388s][info][gc,cpu ] GC(110) User=0.18s Sys=0.00s
Real=0.02s
Humongous Allocations
The Tuneables
94
©2015 CodeKaram
Tuneables
Goal:
Get the GC ergonomics to work for you and
know the defaults
Tunables:
• Pause time goal, heap size, max and min nursery,
concurrent and parallel threads
• The marking threshold, number of mixed GCs
after marking, liveness threshold for the old
regions, garbage toleration threshold, max old
regions to be collected per mixed collection
95
©2015 CodeKaram
Things to remember -
• Know your defaults!
• Understand your G1HeapRegionSize - It could be any factor of
two from 1MB to 32MB. G1 strives for 2048 regions.
• Fixing the nursery size (using Xmn) will meddle with the GC
ergonomics/adaptiveness.
• Don’t set really aggressive pause time goals - this will increase the
GC overhead.
• Spend time taming your mixed GCs - mixed GCs are incremental
collections
96
Tuneables
©2015 CodeKaram
Things to remember -
• Taming mixed GCs:
• Adjust the marking cycle according to you live data set.
• Adjust you liveness threshold - this is the live occupancy threshold
per region. Any region with liveness beyond this threshold will not
be included in a mixed collection.
• Adjust your garbage toleration threshold - helps G1 not get too
aggressive with mixed collections
• Distribute mixed GC pauses over a number of mixed collections -
adjust your mixed GC count target and change your max old region
threshold percent so that you can limit the old regions per collection
97
Tuneables
©2015 CodeKaram
http://www.infoq.com/articles/G1-One-Garbage-
Collector-To-Rule-Them-All
http://www.infoq.com/articles/tuning-tips-G1-GC
http://www.infoq.com/articles/Make-G1-Default-
Garbage-Collector-in-Java-9
Upcoming Book: Java Performance Companion,
Chapters 1-3.
Unified GC Logging: http://openjdk.java.net/jeps/271
98
Further Reading
©2015 CodeKaram
hotspot-gc-use@openjdk.java.net
hotspot-gc-dev@openjdk.java.net
monica@codekaram.com
@mon_beck
99
Questions?

Contenu connexe

Tendances

MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기I Goo Lee
 
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)NTT DATA Technology & Innovation
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevAltinity Ltd
 
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...HostedbyConfluent
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for ExperimentationGleb Kanterov
 
Hardening Kafka Replication
Hardening Kafka Replication Hardening Kafka Replication
Hardening Kafka Replication confluent
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesYoshinori Matsunobu
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...Altinity Ltd
 
Spark Summit East 2015 Advanced Devops Student Slides
Spark Summit East 2015 Advanced Devops Student SlidesSpark Summit East 2015 Advanced Devops Student Slides
Spark Summit East 2015 Advanced Devops Student SlidesDatabricks
 
10 Good Reasons to Use ClickHouse
10 Good Reasons to Use ClickHouse10 Good Reasons to Use ClickHouse
10 Good Reasons to Use ClickHouserpolat
 
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...Red Hat Developers
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningSimone Bordet
 
YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing PerformanceBrendan Gregg
 
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, Adjust
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, AdjustShipping Data from Postgres to Clickhouse, by Murat Kabilov, Adjust
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, AdjustAltinity Ltd
 
When Apache Spark Meets TiDB with Xiaoyu Ma
When Apache Spark Meets TiDB with Xiaoyu MaWhen Apache Spark Meets TiDB with Xiaoyu Ma
When Apache Spark Meets TiDB with Xiaoyu MaDatabricks
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...Altinity Ltd
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlJiangjie Qin
 
Hyperspace for Delta Lake
Hyperspace for Delta LakeHyperspace for Delta Lake
Hyperspace for Delta LakeDatabricks
 
TiDB as an HTAP Database
TiDB as an HTAP DatabaseTiDB as an HTAP Database
TiDB as an HTAP DatabasePingCAP
 
JVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニングJVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニング佑哉 廣岡
 

Tendances (20)

MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)
Hadoop Compatible File Systems 2019 (db tech showcase 2019 Tokyo講演資料、2019/09/25)
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for Experimentation
 
Hardening Kafka Replication
Hardening Kafka Replication Hardening Kafka Replication
Hardening Kafka Replication
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability Practices
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
 
Spark Summit East 2015 Advanced Devops Student Slides
Spark Summit East 2015 Advanced Devops Student SlidesSpark Summit East 2015 Advanced Devops Student Slides
Spark Summit East 2015 Advanced Devops Student Slides
 
10 Good Reasons to Use ClickHouse
10 Good Reasons to Use ClickHouse10 Good Reasons to Use ClickHouse
10 Good Reasons to Use ClickHouse
 
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
Event-driven autoscaling through KEDA and Knative Integration | DevNation Tec...
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and Tuning
 
YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing Performance
 
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, Adjust
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, AdjustShipping Data from Postgres to Clickhouse, by Murat Kabilov, Adjust
Shipping Data from Postgres to Clickhouse, by Murat Kabilov, Adjust
 
When Apache Spark Meets TiDB with Xiaoyu Ma
When Apache Spark Meets TiDB with Xiaoyu MaWhen Apache Spark Meets TiDB with Xiaoyu Ma
When Apache Spark Meets TiDB with Xiaoyu Ma
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Hyperspace for Delta Lake
Hyperspace for Delta LakeHyperspace for Delta Lake
Hyperspace for Delta Lake
 
TiDB as an HTAP Database
TiDB as an HTAP DatabaseTiDB as an HTAP Database
TiDB as an HTAP Database
 
JVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニングJVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニング
 

En vedette

Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production DebuggingTakipi
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were PossibleLukas Eder
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaC4Media
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureKelly Goetsch
 

En vedette (7)

Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production Debugging
 
In Search of Segmentation
In Search of SegmentationIn Search of Segmentation
In Search of Segmentation
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To Java
 
Scala Days NYC 2016
Scala Days NYC 2016Scala Days NYC 2016
Scala Days NYC 2016
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright Future
 

Similaire à Java 9 - The (G1) GC Awakens: A Young Collection

Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection HeroTier1app
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Tier1 App
 
Become a GC Hero
Become a GC HeroBecome a GC Hero
Become a GC HeroTier1app
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseTier1 app
 
Gc crash course (1)
Gc crash course (1)Gc crash course (1)
Gc crash course (1)Tier1 app
 
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GC
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GCHadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GC
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GCErik Krogen
 
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsBecome a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsTier1app
 
Become a Java GC Hero - ConFoo Conference
Become a Java GC Hero - ConFoo ConferenceBecome a Java GC Hero - ConFoo Conference
Become a Java GC Hero - ConFoo ConferenceTier1app
 
JDD2015: -XX:+UseG1GC - Jakub Kubryński
JDD2015: -XX:+UseG1GC - Jakub KubryńskiJDD2015: -XX:+UseG1GC - Jakub Kubryński
JDD2015: -XX:+UseG1GC - Jakub KubryńskiPROIDEA
 
Pick diamonds from garbage
Pick diamonds from garbagePick diamonds from garbage
Pick diamonds from garbageTier1 App
 
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorJava Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorGurpreet Sachdeva
 
G1 Garbage Collector - Big Heaps and Low Pauses?
G1 Garbage Collector - Big Heaps and Low Pauses?G1 Garbage Collector - Big Heaps and Low Pauses?
G1 Garbage Collector - Big Heaps and Low Pauses?C2B2 Consulting
 
Garbage First Garbage Collector: Where the Rubber Meets the Road!
Garbage First Garbage Collector: Where the Rubber Meets the Road!Garbage First Garbage Collector: Where the Rubber Meets the Road!
Garbage First Garbage Collector: Where the Rubber Meets the Road!Monica Beckwith
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
State of GeoServer 2012
State of GeoServer 2012State of GeoServer 2012
State of GeoServer 2012Jody Garnett
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short versionAlex Pinkin
 
A compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreA compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreTadeu Zagallo
 
1404 app dev series - session 8 - monitoring & performance tuning
1404   app dev series - session 8 - monitoring & performance tuning1404   app dev series - session 8 - monitoring & performance tuning
1404 app dev series - session 8 - monitoring & performance tuningMongoDB
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase HBaseCon
 

Similaire à Java 9 - The (G1) GC Awakens: A Young Collection (20)

Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection Hero
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
 
Become a GC Hero
Become a GC HeroBecome a GC Hero
Become a GC Hero
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash Course
 
Gc crash course (1)
Gc crash course (1)Gc crash course (1)
Gc crash course (1)
 
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GC
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GCHadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GC
Hadoop Meetup Jan 2019 - Dynamometer and a Case Study in NameNode GC
 
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsBecome a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day Devops
 
Become a Java GC Hero - ConFoo Conference
Become a Java GC Hero - ConFoo ConferenceBecome a Java GC Hero - ConFoo Conference
Become a Java GC Hero - ConFoo Conference
 
JDD2015: -XX:+UseG1GC - Jakub Kubryński
JDD2015: -XX:+UseG1GC - Jakub KubryńskiJDD2015: -XX:+UseG1GC - Jakub Kubryński
JDD2015: -XX:+UseG1GC - Jakub Kubryński
 
-XX:+UseG1GC
-XX:+UseG1GC-XX:+UseG1GC
-XX:+UseG1GC
 
Pick diamonds from garbage
Pick diamonds from garbagePick diamonds from garbage
Pick diamonds from garbage
 
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) CollectorJava Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
Java Garbage Collectors – Moving to Java7 Garbage First (G1) Collector
 
G1 Garbage Collector - Big Heaps and Low Pauses?
G1 Garbage Collector - Big Heaps and Low Pauses?G1 Garbage Collector - Big Heaps and Low Pauses?
G1 Garbage Collector - Big Heaps and Low Pauses?
 
Garbage First Garbage Collector: Where the Rubber Meets the Road!
Garbage First Garbage Collector: Where the Rubber Meets the Road!Garbage First Garbage Collector: Where the Rubber Meets the Road!
Garbage First Garbage Collector: Where the Rubber Meets the Road!
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
State of GeoServer 2012
State of GeoServer 2012State of GeoServer 2012
State of GeoServer 2012
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short version
 
A compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreA compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCore
 
1404 app dev series - session 8 - monitoring & performance tuning
1404   app dev series - session 8 - monitoring & performance tuning1404   app dev series - session 8 - monitoring & performance tuning
1404 app dev series - session 8 - monitoring & performance tuning
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase
 

Plus de Monica Beckwith

The ilities of software engineering.pptx
The ilities of software engineering.pptxThe ilities of software engineering.pptx
The ilities of software engineering.pptxMonica Beckwith
 
Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Monica Beckwith
 
Applying Concurrency Cookbook Recipes to SPEC JBB
Applying Concurrency Cookbook Recipes to SPEC JBBApplying Concurrency Cookbook Recipes to SPEC JBB
Applying Concurrency Cookbook Recipes to SPEC JBBMonica Beckwith
 
Intro to Garbage Collection
Intro to Garbage CollectionIntro to Garbage Collection
Intro to Garbage CollectionMonica Beckwith
 
OpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsOpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsMonica Beckwith
 
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSOPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSMonica Beckwith
 
The Performance Engineer's Guide to Java (HotSpot) Virtual Machine
The Performance Engineer's Guide to Java (HotSpot) Virtual MachineThe Performance Engineer's Guide to Java (HotSpot) Virtual Machine
The Performance Engineer's Guide to Java (HotSpot) Virtual MachineMonica Beckwith
 
JFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceJFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceMonica Beckwith
 
Java Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideJava Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideMonica Beckwith
 
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...Monica Beckwith
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationMonica Beckwith
 
Game of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCGame of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCMonica Beckwith
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Monica Beckwith
 
GC Tuning Confessions Of A Performance Engineer - Improved :)
GC Tuning Confessions Of A Performance Engineer - Improved :)GC Tuning Confessions Of A Performance Engineer - Improved :)
GC Tuning Confessions Of A Performance Engineer - Improved :)Monica Beckwith
 
GC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerGC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerMonica Beckwith
 

Plus de Monica Beckwith (18)

The ilities of software engineering.pptx
The ilities of software engineering.pptxThe ilities of software engineering.pptx
The ilities of software engineering.pptx
 
A G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptxA G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptx
 
ZGC-SnowOne.pdf
ZGC-SnowOne.pdfZGC-SnowOne.pdf
ZGC-SnowOne.pdf
 
QCon London.pdf
QCon London.pdfQCon London.pdf
QCon London.pdf
 
Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!
 
Applying Concurrency Cookbook Recipes to SPEC JBB
Applying Concurrency Cookbook Recipes to SPEC JBBApplying Concurrency Cookbook Recipes to SPEC JBB
Applying Concurrency Cookbook Recipes to SPEC JBB
 
Intro to Garbage Collection
Intro to Garbage CollectionIntro to Garbage Collection
Intro to Garbage Collection
 
OpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsOpenJDK Concurrent Collectors
OpenJDK Concurrent Collectors
 
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORSOPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
OPENJDK: IN THE NEW AGE OF CONCURRENT GARBAGE COLLECTORS
 
The Performance Engineer's Guide to Java (HotSpot) Virtual Machine
The Performance Engineer's Guide to Java (HotSpot) Virtual MachineThe Performance Engineer's Guide to Java (HotSpot) Virtual Machine
The Performance Engineer's Guide to Java (HotSpot) Virtual Machine
 
JFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceJFokus Java 9 contended locking performance
JFokus Java 9 contended locking performance
 
Java Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideJava Performance Engineer's Survival Guide
Java Performance Engineer's Survival Guide
 
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
 
Game of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCGame of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GC
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
 
GC Tuning Confessions Of A Performance Engineer - Improved :)
GC Tuning Confessions Of A Performance Engineer - Improved :)GC Tuning Confessions Of A Performance Engineer - Improved :)
GC Tuning Confessions Of A Performance Engineer - Improved :)
 
GC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance EngineerGC Tuning Confessions Of A Performance Engineer
GC Tuning Confessions Of A Performance Engineer
 

Dernier

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Dernier (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Java 9 - The (G1) GC Awakens: A Young Collection

  • 1. Java 9 - The (G1) GC Awakens QCon London 2016 1 Monica Beckwith monica@codekaram.com; @mon_beck https://www.linkedin.com/in/monicabeckwith www.codekaram.com
  • 2. ©2016 CodeKaram A long time ago in a galaxy (not so) far, far away…. 2
  • 5. ©2016 CodeKaram About Me • Java/JVM/GC Performance Consultant • Have worked with HotSpot for more than a decade. • Was the performance lead for G1 GC @Oracle. 5
  • 6. ©2016 CodeKaram Agenda • Heap Regions • Additional Data Structures • CSet & RSets • Young Collection • Marking Threshold & Concurrent Marking Stages • Mixed Collection • Evacuation Failures • Fragmentation • Humongous Objects • Tuneables 6
  • 7. G1 GC Heap Regions 7
  • 8. ©2016 CodeKaram Heap Regions 8 Contiguous Java Heap Free Region Non-Free Region
  • 9. ©2016 CodeKaram • Heap region size = heap size/2048 • can range from 1 MB to 32 MB • is a power of 2 • is aligned 9 Heap Regions
  • 11. ©2016 CodeKaram • Young Regions - Regions that house objects in the Eden and Survivor Spaces • Old Regions - Regions that house objects in the Old generation. • Humongous Regions - Regions that house Humongous Objects. 11 Heap Regions
  • 13. ©2016 CodeKaram G1 GC Collection Set & Remembered Sets • Additional data structure to help with maintenance and collection • Add a slight footprint overhead (~5%) 13
  • 15. ©2016 CodeKaram Collection Set • A young collection set (CSet) will incorporate all the young regions • A mixed collection set will incorporate all the young regions and a few candidate old regions based on the “most garbage first” principle. 15
  • 16. ©2016 CodeKaram Eden Old Old Eden Old Surv ivor CSet during a young collection - 16 Collection Set
  • 17. ©2016 CodeKaram Old Old Old CSet during a mixed collection - Sur viv or Ol d Eden Eden 17 Collection Set
  • 18. ©2016 CodeKaram • G1MixedGCLiveThresholdPercent 18 Enable UnlockExperimentalVMOptions Collection Set
  • 19. ©2016 CodeKaram • G1OldCSetRegionThresholdPercent 19 Enable UnlockExperimentalVMOptions Collection Set
  • 20. ©2016 CodeKaram20 [86.548s][debug][gc,ergo,cset] GC(71) Finish adding old regions to CSet (reclaimable percentage not over threshold). old 13 regions, max 68 regions, reclaimable: 35485144B (4.98%) threshold: 5% Log Output with - Xlog:gc*,ergo*=trace • G1OldCSetRegionThresholdPercent
  • 22. ©2016 CodeKaram • Maintains and tracks incoming references into its region • old-to-young references • old-to-old references • Remembered sets have varying granularity based on the “popularity” of objects or regions. 22 Remembered Sets
  • 23. Quick Info: The next few figures and log outputs are from chapters 2 and 3 of the upcoming Java Performance Companion and will be marked with **. 23
  • 24. ©2016 CodeKaram24 Figure 2.3 Remembered sets with incoming object references**
  • 25. ©2016 CodeKaram Remembered Sets • Different granularities: • sparse per-region-table (PRT) • fine-grained PRT • coarse-grained bitmap 25
  • 26. ©2016 CodeKaram26 Recent concurrent refinement statistics Processed 23270 cards Of 96 completed buffers: 96 (100.0%) by concurrent RS threads. 0 ( 0.0%) by mutator threads Did 0 coarsenings. ** -XX:+UnlockDiagnosticVMOptions - XX:G1SummarizeRSetStatsPeriod=1 Log Output with -Xlog:gc +remset=trace
  • 28. ©2016 CodeKaram G1 GC Heap Eden Old Old Eden Old Surv ivor 28
  • 29. ©2016 CodeKaram During a Young Collection Eden Old Old Eden Old Surv ivor 29
  • 30. ©2016 CodeKaram After a Young Collection Old Old Old Sur viv or Ol d 30
  • 31. A Young Collection Log Snippet with -Xlog:gc*,gc +phases=debug 31
  • 32. ©2016 CodeKaram32 [10.578s][info ][gc,start ] GC(20) Pause Mixed (G1 Evacuation Pause) (10.578s) [10.603s][debug ][gc,phases ] GC(20) Parallel Time: 24.1 ms [10.603s][debug ][gc,phases ] GC(20) GC Worker Start: Min: 10578.1, Avg: 10578.1, Max: 10578.1, Diff: 0.0 [10.603s][debug ][gc,phases ] GC(20) Ext Root Scanning: Min: 0.2, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.9 [10.603s][debug ][gc,phases ] GC(20) Thread Roots: Min: 0.0, Avg: 0.1, Max: 0.3, Diff: 0.3, Sum: 0.6 [10.603s][debug ][gc,phases ] GC(20) StringTable Roots: Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.1 [10.603s][debug ][gc,phases ] GC(20) Universe Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) JNI Handles Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) ObjectSynchronizer Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) FlatProfiler Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) Management Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) SystemDictionary Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) CLDG Roots: Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.2 [10.603s][debug ][gc,phases ] GC(20) JVMTI Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) CM RefProcessor Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) Wait For Strong CLD: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) Weak CLD Roots: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) SATB Filtering: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) Update RS: Min: 3.9, Avg: 4.0, Max: 4.2, Diff: 0.3, Sum: 32.3 [10.603s][debug ][gc,phases ] GC(20) Processed Buffers: Min: 5, Avg: 6.2, Max: 8, Diff: 3, Sum: 50 [10.603s][debug ][gc,phases ] GC(20) Scan HCC: Min: 0.4, Avg: 0.5, Max: 0.5, Diff: 0.1, Sum: 3.8 [10.603s][debug ][gc,phases ] GC(20) Scan RS: Min: 6.0, Avg: 10.4, Max: 11.2, Diff: 5.2, Sum: 82.9 [10.603s][debug ][gc,phases ] GC(20) Code Root Scanning: Min: 0.0, Avg: 0.7, Max: 5.2, Diff: 5.2, Sum: 5.3 [10.603s][debug ][gc,phases ] GC(20) Object Copy: Min: 8.6, Avg: 8.7, Max: 8.8, Diff: 0.2, Sum: 69.4 [10.603s][debug ][gc,phases ] GC(20) Termination: Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.7 [10.603s][debug ][gc,phases ] GC(20) Termination Attempts: Min: 1, Avg: 12.2, Max: 16, Diff: 15, Sum: 98 [10.603s][debug ][gc,phases ] GC(20) GC Worker Other: Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0 [10.603s][debug ][gc,phases ] GC(20) GC Worker Total: Min: 24.0, Avg: 24.1, Max: 24.1, Diff: 0.0, Sum: 192.5 [10.603s][debug ][gc,phases ] GC(20) GC Worker End: Min: 10602.2, Avg: 10602.2, Max: 10602.2, Diff: 0.0 Young Collection
  • 33. ©2016 CodeKaram33 [10.603s][debug ][gc,phases ] GC(20) Code Root Fixup: 0.1 ms [10.603s][debug ][gc,phases ] GC(20) Code Root Purge: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Clear CT: 0.1 ms [10.603s][debug ][gc,phases ] GC(20) Expand Heap After Collection: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Other: 0.7 ms [10.603s][debug ][gc,phases ] GC(20) Choose CSet: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Ref Proc: 0.1 ms [10.603s][debug ][gc,phases ] GC(20) Ref Enq: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Redirty Cards: 0.1 ms [10.603s][debug ][gc,phases ] GC(20) Parallel Redirty: Min: 0.1, Avg: 0.1, Max: 0.1, Diff: 0.0, Sum: 0.8 [10.603s][debug ][gc,phases ] GC(20) Redirtied Cards: Min: 7563, Avg: 8703.4, Max: 10349, Diff: 2786, Sum: 69627 [10.603s][debug ][gc,phases ] GC(20) Humongous Register: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Humongous Reclaim: 0.0 ms [10.603s][debug ][gc,phases ] GC(20) Free CSet: 0.3 ms [10.603s][info ][gc,heap ] GC(20) Eden regions: 14->0(164) [10.603s][info ][gc,heap ] GC(20) Survivor regions: 11->1(4) [10.603s][info ][gc,heap ] GC(20) Old regions: 202->203 [10.603s][info ][gc,heap ] GC(20) Humongous regions: 6->6 [10.603s][info ][gc,metaspace] GC(20) Metaspace: 9996K->9996K(1058816K) [10.603s][info ][gc ] GC(20) Pause Mixed (G1 Evacuation Pause) 232M->209M(500M) (10.578s, 10.603s) 25.329ms [10.603s][info ][gc,cpu ] GC(20) User=0.19s Sys=0.00s Real=0.03s Young Collection
  • 34. A Young Collection Log Snippet with -XX: +PrintGCDetails 34
  • 35. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)- >379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 35 Young Collection
  • 36. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 36 Young Collection
  • 37. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 37 Young Collection
  • 38. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 38 Young Collection
  • 39. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 39 Young Collection
  • 40. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 40 Young Collection
  • 41. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 41 Young Collection
  • 42. ©2016 CodeKaram 154.431: [GC pause (G1 Evacuation Pause) (young), 0.2584864 secs] [Parallel Time: 253.2 ms, GC Workers: 8] [GC Worker Start (ms): Min: 154431.3, Avg: 154431.4, Max: 154431.5, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.1, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 1.4] [Update RS (ms): Min: 3.3, Avg: 3.5, Max: 3.8, Diff: 0.6, Sum: 28.2] [Processed Buffers: Min: 3, Avg: 3.5, Max: 5, Diff: 2, Sum: 28] [Scan RS (ms): Min: 46.1, Avg: 46.4, Max: 46.7, Diff: 0.6, Sum: 371.2] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [Object Copy (ms): Min: 202.7, Avg: 202.8, Max: 202.9, Diff: 0.3, Sum: 1622.4] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.5] [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [GC Worker Total (ms): Min: 253.0, Avg: 253.1, Max: 253.1, Diff: 0.1, Sum: 2024.7] [GC Worker End (ms): Min: 154684.5, Avg: 154684.5, Max: 154684.5, Diff: 0.1] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.7 ms] [Other: 4.4 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.3 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.3 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 3.2 ms] [Eden: 4972.0M(4972.0M)->0.0B(4916.0M) Survivors: 148.0M->204.0M Heap: 5295.8M(10.0G)->379.4M(10.0G)] [Times: user=1.72 sys=0.14, real=0.26 secs] 42 Young Collection
  • 45. ©2016 CodeKaram Initiating Heap Occupancy Percent 45 • Threshold to start the concurrent marking cycle to identify candidate old regions. • When old generation occupancy crosses this adaptive threshold. • Based on the total heap size.
  • 47. ©2016 CodeKaram Concurrent Marking - Initial Mark Stage 47 • stop the world, piggy-backed on a young pause • marks all root objects
  • 48. ©2016 CodeKaram Concurrent Marking - Root Region Scanning Stage 48 • works concurrently with the mutators • survivor regions are root regions • must complete before the next GC pause
  • 49. ©2016 CodeKaram Concurrent Marking - Concurrent Marking Stage 49 • works concurrently with the mutators • -XX:ConcGCThreads • pre-write barrier needed • live data accounting • XX:+ClassUnloadingWithConcurrentMark
  • 50. ©2016 CodeKaram Concurrent Marking - Final Mark Stage 50 • stop the world • XX:ParallelGCThreads • traverse any unvisited live objects. • safely complete live data accounting. • reference processing • XX:+ParallelRefProcEnabled
  • 51. ©2016 CodeKaram Concurrent Marking - Cleanup Stage 51 • stop the world • identifying completely free regions • sorting regions based on “efficiency” • RSet scrubbing • concurrent • reset and return empty region to the free list.
  • 52. ©2016 CodeKaram G1 GC Heap Old Old Old Sur viv or Ol d Eden Eden Old 52
  • 55. Concurrent Marking Stages Log Snippet with - Xlog:gc*,ergo* 55
  • 56. ©2016 CodeKaram56 [9.474s][info][gc,start ] GC(17) Pause Initial Mark (G1 Evacuation Pause) (9.474s) [9.507s][info][gc,heap ] GC(17) Eden regions: 142->0(143) [9.507s][info][gc,heap ] GC(17) Survivor regions: 6->11(19) [9.507s][info][gc,heap ] GC(17) Old regions: 218->218 [9.507s][info][gc,heap ] GC(17) Humongous regions: 30->30 [9.507s][info][gc,metaspace] GC(17) Metaspace: 9976K->9976K(1058816K) [9.507s][info][gc ] GC(17) Pause Initial Mark (G1 Evacuation Pause) 395M- >258M(500M) (9.474s, 9.507s) 33.170ms [9.507s][info][gc,cpu ] GC(17) User=0.20s Sys=0.00s Real=0.03s [9.507s][info][gc ] GC(18) Concurrent Root Region Scan (9.507s) [9.534s][info][gc ] GC(18) Concurrent Root Region Scan (9.507s, 9.534s) 26.740ms [9.534s][info][gc ] GC(18) Concurrent Mark (9.534s) [9.791s][info][gc ] GC(18) Concurrent Mark (9.534s, 9.791s) 256.961ms [9.791s][info][gc,start ] GC(18) Pause Remark (9.791s) [9.794s][info][gc ] GC(18) Pause Remark 269M->269M(500M) (9.791s, 9.794s) 3.008ms [9.794s][info][gc,cpu ] GC(18) User=0.01s Sys=0.00s Real=0.01s [9.794s][info][gc,start ] GC(18) Pause Cleanup (9.794s) [9.795s][info][gc ] GC(18) Pause Cleanup 269M->223M(500M) (9.794s, 9.795s) 1.219ms [9.795s][info][gc,cpu ] GC(18) User=0.01s Sys=0.00s Real=0.00s [9.795s][info][gc ] GC(18) Concurrent Cleanup (9.795s) [9.795s][info][gc ] GC(18) Concurrent Cleanup (9.795s, 9.795s) 0.115ms Concurrent Marking Stages
  • 59. ©2016 CodeKaram Old Old Old Sur viv or Ol d Eden Eden During a Mixed Collection 59
  • 61. A Mixed Collection Log Snippet with - Xlog:gc*,ergo*=trace 61
  • 62. ©2016 CodeKaram62 [98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s) [98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms [98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 [98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5 [98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193) [98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25) [98.927s][info ][gc,heap ] GC(40) Old regions: 291->289 [98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14 [98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K) [98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s) 47.529ms [98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s Mixed GC
  • 63. ©2016 CodeKaram63 [98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s) [98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms [98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 [98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5 [98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193) [98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25) [98.927s][info ][gc,heap ] GC(40) Old regions: 291->289 [98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14 [98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K) [98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M- >309M(1024M) (98.879s, 98.927s) 47.529ms [98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s Mixed GC
  • 64. ©2016 CodeKaram64 [98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s) [98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms [98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 [98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5 [98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193) [98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25) [98.927s][info ][gc,heap ] GC(40) Old regions: 291->289 [98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14 [98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K) [98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s) 47.529ms [98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s Mixed GC
  • 65. ©2016 CodeKaram65 [98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s) [98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms [98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 [98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5 [98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193) [98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25) [98.927s][info ][gc,heap ] GC(40) Old regions: 291->289 [98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14 [98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K) [98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s) 47.529ms [98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s Mixed GC
  • 67. ©2016 CodeKaram67 [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 Mixed GC
  • 68. ©2016 CodeKaram68 [239.335s][debug][gc,ergo,cset] GC(145) Finish adding old regions to CSet (predicted time is too high). predicted time: 1.23ms, remaining time: 0.83ms old 45 regions, min 16 regions [239.335s][debug][gc,ergo,cset] GC(145) Finish choosing CSet. old: 45 regions, predicted old region time: 28.08ms, time remaining: 0.83 Mixed GC
  • 70. ©2016 CodeKaram70 [98.879s][info ][gc,start ] GC(40) Pause Mixed (G1 Evacuation Pause) (98.879s) [98.879s][trace][gc,ergo,cset] GC(40) Start choosing CSet. pending cards: 9847 predicted base time: 9.51ms remaining time: 40.49ms target pause time: 50.00ms [98.879s][trace][gc,ergo,cset] GC(40) Add young regions to CSet. eden: 179 regions, survivors: 21 regions, predicted young region time: 76.52ms, target pause time: 50.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish adding old regions to CSet (predicted time is too high). predicted time: 0.77ms, remaining time: 0.00ms old 22 regions, min 22 regions [98.880s][debug][gc,ergo,cset] GC(40) Added expensive regions to CSet (old CSet region num not reached min).old: 22 regions, expensive: 22 regions, min: 22 regions, remaining time: 0.00ms [98.880s][debug][gc,ergo,cset] GC(40) Finish choosing CSet. old: 22 regions, predicted old region time: 14.78ms, time remaining: 0.00 [98.927s][debug][gc,ergo ] GC(40) continue mixed GCs (candidate old regions available). candidate old regions: 148 reclaimable: 91013912 (8.48) threshold: 5 [98.927s][info ][gc,heap ] GC(40) Eden regions: 179->0(193) [98.927s][info ][gc,heap ] GC(40) Survivor regions: 21->7(25) [98.927s][info ][gc,heap ] GC(40) Old regions: 291->289 [98.927s][info ][gc,heap ] GC(40) Humongous regions: 14->14 [98.927s][info ][gc,metaspace] GC(40) Metaspace: 10418K->10418K(1058816K) [98.927s][info ][gc ] GC(40) Pause Mixed (G1 Evacuation Pause) 503M->309M(1024M) (98.879s, 98.927s) 47.529ms [98.927s][info ][gc,cpu ] GC(40) User=0.36s Sys=0.01s Real=0.05s Mixed GC
  • 73. ©2016 CodeKaram Evacuation Failures 73 276.731: [GC pause (G1 Evacuation Pause) (young) (to-space exhausted), 0.8272932 secs] [Parallel Time: 387.0 ms, GC Workers: 8] <snip> [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.2 ms] [Other: 440.0 ms] [Evacuation Failure: 437.5 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.1 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.9 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 0.9 ms] [Eden: 831.0M(900.0M)->0.0B(900.0M) Survivors: 0.0B->0.0B Heap: 1020.1M(1024.0M)- >1020.1M(1024.0M)] [Times: user=3.64 sys=0.20, real=0.83 secs] **
  • 74. ©2015 CodeKaram • When there are no more regions available for survivors or tenured objects, G1 GC encounters an evacuation failure. • An evacuation failure is expensive and the usual pattern is that if you see a couple of evacuation failures; full GC could* soon follow. 74 Evacuation Failures
  • 75. ©2015 CodeKaram A heavily tuned JVM command line may be restricting the G1 GC ergonomics and adaptability. Start with just your heap sizes and a reasonable pause time goal 75 Avoiding Evacuation Failures
  • 76. ©2015 CodeKaram Your live data set + long live transient data may be too large for the old generation Check LDS+ and increase heap to accommodate everything in the old generation. 76 Avoiding Evacuation Failures
  • 77. ©2015 CodeKaram Initiating Heap Occupancy Threshold could be the issue. Check IHOP and make sure it accommodates the LDS+. IHOP threshold too high -> Delayed marking -> Delayed incremental compaction -> Evacuation Failures! 77 Avoiding Evacuation Failures
  • 78. ©2015 CodeKaram Marking Cycle could be taking too long to complete? Increase concurrent marking threads Reduce IHOP 78 Avoiding Evacuation Failures
  • 79. ©2015 CodeKaram to-space survivors are the problem? Increase the G1ReservePercent, if to-space survivors are triggering the evacuation failures! 79 Avoiding Evacuation Failures
  • 80. ©2015 CodeKaram fragmentation an issue? 80 Avoiding Evacuation Failures
  • 81. Fragmentation In The G1 Collector 81
  • 82. ©2015 CodeKaram • G1 GC is designed to “absorb” some fragmentation. • Default is 5% of the total Java heap • Tradeoff so that expensive regions are left out. G1 Heap Waste Percentage 82
  • 83. ©2015 CodeKaram G1 Mixed GC (Region) Liveness Threshold 83 • G1 GC’s old regions are also designed to “absorb” some fragmentation. • Default is 85% liveness in a G1 region. • Tradeoff so that expensive regions are left out.
  • 85. ©2016 CodeKaram Humongous Objects 85 An old generation region A young generation region
  • 86. ©2016 CodeKaram Humongous Objects 86 Object < 50% of G1 region size Object >= 50% of G1 region size Object > G1 region size ??
  • 87. ©2016 CodeKaram87 Object < 50% of G1 region size Humongous Objects
  • 88. ©2016 CodeKaram88 Object >= 50% of G1 region size Humongous Objects
  • 89. ©2016 CodeKaram89 Object > G1 region size Humongous Objects
  • 90. ©2016 CodeKaram90 Object NOT Humongous Object Humongous Object Humongous -> Needs Contiguous Regions Wasted Space! Humongous Objects
  • 91. ©2016 CodeKaram Ideally, humongous objects are few in number and are short lived. A lot of long-lived humongous objects can cause evacuation failures since humongous regions add to the old generation occupancy. 91 Humongous Objects
  • 92. Humongous Allocation Log Snippet with - Xlog:gc*,ergo* 92
  • 93. ©2016 CodeKaram93 [161.363s][info][gc,start ] GC(110) Pause Initial Mark (G1 Humongous Allocation) (161.363s) [161.388s][info][gc,heap ] GC(110) Eden regions: 33- >0(61) [161.388s][info][gc,heap ] GC(110) Survivor regions: 14- >5(13) [161.388s][info][gc,heap ] GC(110) Old regions: 431->445 [161.388s][info][gc,heap ] GC(110) Humongous regions: 32- >32 [161.388s][info][gc,metaspace] GC(110) Metaspace: 10422K- >10422K(1058816K) [161.388s][info][gc ] GC(110) Pause Initial Mark (G1 Humongous Allocation) 508M->481M(662M) (161.363s, 161.388s) 25.455ms [161.388s][info][gc,cpu ] GC(110) User=0.18s Sys=0.00s Real=0.02s Humongous Allocations
  • 95. ©2015 CodeKaram Tuneables Goal: Get the GC ergonomics to work for you and know the defaults Tunables: • Pause time goal, heap size, max and min nursery, concurrent and parallel threads • The marking threshold, number of mixed GCs after marking, liveness threshold for the old regions, garbage toleration threshold, max old regions to be collected per mixed collection 95
  • 96. ©2015 CodeKaram Things to remember - • Know your defaults! • Understand your G1HeapRegionSize - It could be any factor of two from 1MB to 32MB. G1 strives for 2048 regions. • Fixing the nursery size (using Xmn) will meddle with the GC ergonomics/adaptiveness. • Don’t set really aggressive pause time goals - this will increase the GC overhead. • Spend time taming your mixed GCs - mixed GCs are incremental collections 96 Tuneables
  • 97. ©2015 CodeKaram Things to remember - • Taming mixed GCs: • Adjust the marking cycle according to you live data set. • Adjust you liveness threshold - this is the live occupancy threshold per region. Any region with liveness beyond this threshold will not be included in a mixed collection. • Adjust your garbage toleration threshold - helps G1 not get too aggressive with mixed collections • Distribute mixed GC pauses over a number of mixed collections - adjust your mixed GC count target and change your max old region threshold percent so that you can limit the old regions per collection 97 Tuneables