The Z Garbage Collector Scalable Low-Latency GC in JDK 11 Per Lidén (@perliden) Consulting Member of Technical Staff Java Platform Group, Oracle October 24, 2018
Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle. 2
Agenda 1 2 3 4 5 What is ZGC? A Peek Under the Hood Performance Using ZGC Future Plans 3
What is ZGC? 4
New Garbage Collector in JDK 11 (Experimental feature, Linux/x86_64 only) 5
A Scalable Low-Latency Garbage Collector 6
Goals TB Multi-terabyte heaps 10ms Max GC pause time Easy to tune 15% Max application throughput reduction 7
ZGC at a Glance Concurrent Tracing Compacting Single generation Region-based NUMA-aware Load barriers Colored pointers 8
ZGC pause times do not increase with the heap or live-set size 9
ZGC pause times do increase with the root-set size (Number of Java Threads) 10
Concurrent? Marking Relocation/Compaction Reference Processing Relocation Set Selection StringTable Cleaning JNI WeakRef Cleaning JNI GlobalRefs Scanning Class Unloading Thread Stack Scanning Serial Parallel CMS G1 ZGC 11
Concurrent? Marking - - Relocation/Compaction - - Reference Processing - - Relocation Set Selection - - StringTable Cleaning - - JNI WeakRef Cleaning - - JNI GlobalRefs Scanning - - Class Unloading - - Thread Stack Scanning - - Serial Parallel CMS G1 ZGC 12
**) Old Gen Only Concurrent? Serial Parallel CMS G1 ZGC Marking - - * * Relocation/Compaction - - - - Reference Processing - - - - Relocation Set Selection - - - - StringTable Cleaning - - - - JNI WeakRef Cleaning - - - - JNI GlobalRefs Scanning - - - - Class Unloading - - - - Thread Stack Scanning - - - - 13
Concurrent? **) Old Gen Only **) Post JDK 11 Serial Parallel CMS G1 ZGC Marking - - * * Relocation/Compaction - - - - Reference Processing - - - - Relocation Set Selection - - - - StringTable Cleaning - - - - JNI WeakRef Cleaning - - - - JNI GlobalRefs Scanning - - - - ** Class Unloading - - - - ** Thread Stack Scanning - - - - - 14
A Peek Under the Hood 15
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate GC Cycle 16
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate Scan thread stacks GC Cycle 17
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate Walk object graph GC Cycle 18
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate Synchronization point GC Cycle 19
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate GC Cycle Reference processing Weak root cleaning Relocation set selection 20
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate GC Cycle Scan thread stacks 21
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate GC Cycle Compact heap 22
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate GC Cycle 23
ZGC Phases Pause Mark Start Pause Mark End Pause Relocate Start Concurrent Mark/Remap Concurrent Prepare for Reloc. Concurrent Relocate < 10 ms GC < 10 Cycle ms < 10 ms 24
Colored Pointers Core design concept in ZGC Metadata stored in unused bits in 64-bit pointers No support for 32-bit platforms No support for CompressedOops Colors Unused (18 bits) Object Address (42 bits, 4TB address space) 64-bit Object Pointer 25
Load Barrier A small piece of code injected by the JIT in strategic places When loading an object reference from the heap Checks if the loaded object reference has a bad color If so, take action and correct it 26
Load Barrier String n = person.name; // Loading an object reference from heap Person String name; int age; double height; String... 27
Load Barrier String n = person.name; <load barrier needed here> // Loading an object reference from heap Person String name; int age; double height; String... 28
Load Barrier String n = person.name; <load barrier needed here> String p = n; n.isempty(); int age = person.age; // Loading an object reference from heap // No barrier, not a load from heap // No barrier, not a load from heap // No barrier, not an object reference Person String name; int age; double height; String... 29
Load Barrier String n = person.name; <load barrier needed here> // Loading an object reference from heap Person String name; int age; double height; String... 30
Load Barrier String n = person.name; // Loading an object reference from heap if (n & bad_bit_mask) { slow_path(register_for(n), address_of(person.name)); } Person String name; int age; double height; String... 31
Load Barrier mov 0x10(%rax), %rbx // String n = person.name; test %rbx, (0x16)%r15 // Bad color? jnz slow_path // Yes -> Enter slow path and // mark/relocate/remap, adjust // 0x10(%rax) and %rbx 32
Load Barrier mov 0x10(%rax), %rbx // String n = person.name; test %rbx, (0x16)%r15 // Bad color? jnz slow_path // Yes -> Enter slow path and // mark/relocate/remap, adjust // 0x10(%rax) and %rbx ~4% execution overhead on SPECjbb 2015 33
Performance 34
SPECjbb 2015 Score (Higher is better) 100% 90% 80% 70% 60% Mode: Composite Heap Size: 128G OS: Oracle Linux 7.4 HW: Intel Xeon E5-2690 2.9GHz 2 sockets, 16 cores (32 hw-threads) 50% 40% 30% 20% 10% 0% ZGC Parallel G1 max-jops (Throughput) critical-jops (Throughput with latency requirements) SPECjbb 2015 is a registered trademark of the Standard Performance Evaluation Corporation (spec.org). The actual results are not represented as compliant because the SUT may not meet SPEC's requirements for general availability. 35
SPECjbb 2015 Score 100% 90% 80% (Higher is better) Mode: Composite Heap Size: 128G OS: Oracle Linux 7.4 70% 60% 50% 29% HW: Intel Xeon E5-2690 2.9GHz 2 sockets, 16 cores (32 hw-threads) 50% 40% 30% 20% 10% 0% ZGC Parallel G1 max-jops (Throughput) critical-jops (Throughput with latency requirements) SPECjbb 2015 is a registered trademark of the Standard Performance Evaluation Corporation (spec.org). The actual results are not represented as compliant because the SUT may not meet SPEC's requirements for general availability. 36
GC Pause Times (ms) SPECjbb 2015 Pause Times 600 Linear scale (Lower is better) 500 400 300 200 100 0 ZGC Parallel G1 Average 95th percentile 99th percentile 99.9th percentile Max 37
GC Pause Times (ms) SPECjbb 2015 Pause Times 1000 Logarithmic scale (Lower is better) 100 10 1 ZGC Parallel G1 Average 95th percentile 99th percentile 99.9th percentile Max 38
GC Pause Times (ms) SPECjbb 2015 Pause Times Logarithmic scale (Lower is better) 1000 211 306 156 544 100 10 1 1.10 1.96 ZGC Parallel G1 Average 95th percentile 99th percentile 99.9th percentile Max 39
GC Pause Times (ms) SPECjbb 2015 Pause Times Logarithmic scale (Lower is better) 1000 211 306 156 544 100 10 1 1.10 1.96 ZGC Parallel G1 Average 95th percentile 99th percentile 99.9th percentile Max 40
Using ZGC 41
Enable -XX:+UseZGC 42
Enable -XX:+UnlockExperimentalVMOptions -XX:+UseZGC 43
Tuning 44
Tuning Set Max Heap Size -Xmx<size> 45
Tuning Maybe Set Number of Concurrent GC Threads -Xmx<size> -XX:ConcGCThreads=<number> 46
Tuning That s it? -Xmx<size> -XX:ConcGCThreads=<number> 47
Logging -Xlog:gc (basic) -Xlog:gc* (detailed) 48
Garbage Collection (Proactive) 13426M(10%)->2492M(2%) Garbage Collection (Allocation Rate) 87676M(67%)->19578M(15%) Garbage Collection (Allocation Rate) 55302M(42%)->17646M(13%) Garbage Collection (Allocation Rate) 61794M(47%)->26794M(20%) Garbage Collection (Allocation Rate) 60856M(46%)->31926M(24%) Garbage Collection (Allocation Rate) 52744M(40%)->38050M(29%) Garbage Collection (Allocation Rate) 42542M(32%)->32204M(25%) Garbage Collection (Allocation Rate) 49974M(38%)->8534M(7%) Garbage Collection (System.gc()) 8534M(7%)->282M(0%) Garbage Collection (Allocation Rate) 95454M(73%)->25660M(20%) Garbage Collection (Allocation Rate) 42478M(32%)->23812M(18%) Garbage Collection (Allocation Rate) 56714M(43%)->29090M(22%) Garbage Collection (Allocation Rate) 62802M(48%)->28648M(22%) Garbage Collection (Allocation Rate) 59748M(46%)->23770M(18%) Garbage Collection (Allocation Rate) 74946M(57%)->23284M(18%) Garbage Collection (System.gc()) 44902M(34%)->422M(0%) Garbage Collection (Allocation Rate) 94510M(72%)->20456M(16%) Garbage Collection (Allocation Rate) 59694M(46%)->25834M(20%) Garbage Collection (Allocation Rate) 63494M(48%)->29128M(22%) Garbage Collection (Allocation Rate) 59034M(45%)->27094M(21%) Garbage Collection (Allocation Rate) 66110M(50%)->25278M(19%) Garbage Collection (Allocation Rate) 73410M(56%)->27968M(21%) Garbage Collection (Allocation Rate) 70010M(53%)->32236M(25%) Garbage Collection (Allocation Rate) 64444M(49%)->27612M(21%) Garbage Collection (Allocation Rate) 64484M(49%)->29910M(23%) Garbage Collection (Allocation Rate) 64128M(49%)->33184M(25%) Garbage Collection (Allocation Rate) 59148M(45%)->27800M(21%) Garbage Collection (Allocation Rate) 63104M(48%)->27976M(21%) Garbage Collection (Allocation Rate) 64418M(49%)->34390M(26%) Garbage Collection (Allocation Rate) 52284M(40%)->30654M(23%) Garbage Collection (Allocation Rate) 58746M(45%)->32028M(24%) Garbage Collection (Allocation Rate) 59468M(45%)->32804M(25%) Garbage Collection (Allocation Rate) 53342M(41%)->18436M(14%) 49
Garbage Collection (Proactive) 13426M(10%)->2492M(2%) Garbage Collection (Allocation Rate) 87676M(67%)->19578M(15%) Garbage Collection (Allocation Rate) 55302M(42%)->17646M(13%) Garbage Collection (Allocation Rate) 61794M(47%)->26794M(20%) Garbage Collection (Allocation Rate) 60856M(46%)->31926M(24%) Garbage Collection (Allocation Rate) 52744M(40%)->38050M(29%) Garbage Collection (Allocation Rate) 42542M(32%)->32204M(25%) Garbage Collection (Allocation Rate) 49974M(38%)->8534M(7%) Garbage Collection (System.gc()) 8534M(7%)->282M(0%) Garbage Collection (Allocation Rate) 95454M(73%)->25660M(20%) Garbage Collection (Allocation Rate) 42478M(32%)->23812M(18%) Garbage Collection (Allocation Rate) 56714M(43%)->29090M(22%) Garbage Collection (Allocation Rate) 62802M(48%)->28648M(22%) Garbage Collection (Allocation Rate) 59748M(46%)->23770M(18%) Garbage Collection (Allocation Rate) 74946M(57%)->23284M(18%) Garbage Collection (System.gc()) 44902M(34%)->422M(0%) Garbage Collection (Allocation Rate) 94510M(72%)->20456M(16%) Garbage Collection (Allocation Rate) 59694M(46%)->25834M(20%) Garbage Collection (Allocation Rate) 63494M(48%)->29128M(22%) Garbage Collection (Allocation Rate) 59034M(45%)->27094M(21%) Garbage Collection (Allocation Rate) 66110M(50%)->25278M(19%) Garbage Collection (Allocation Rate) 73410M(56%)->27968M(21%) Garbage Collection (Allocation Rate) 70010M(53%)->32236M(25%) Garbage Collection (Allocation Rate) 64444M(49%)->27612M(21%) Garbage Collection (Allocation Rate) 64484M(49%)->29910M(23%) Garbage Collection (Allocation Rate) 64128M(49%)->33184M(25%) Garbage Collection (Allocation Rate) 59148M(45%)->27800M(21%) Garbage Collection (Allocation Rate) 63104M(48%)->27976M(21%) Garbage Collection (Allocation Rate) 64418M(49%)->34390M(26%) Garbage Collection (Allocation Rate) 52284M(40%)->30654M(23%) Garbage Collection (Allocation Rate) 58746M(45%)->32028M(24%) Garbage Collection (Allocation Rate) 59468M(45%)->32804M(25%) Garbage Collection (Allocation Rate) 53342M(41%)->18436M(14%) Garbage Collection (Allocation Rate) 95454M(73%)->25660M(20%) 50
Garbage Collection (Allocation Rate) Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Concurrent Process Non-Strong References 0.367ms Concurrent Reset Relocation Set 18.090ms Concurrent Destroy Detached Pages 0.002ms Concurrent Select Relocation Set 12.295ms Concurrent Prepare Relocation Set 70.922ms Pause Relocate Start 1.419ms Concurrent Relocate 645.941ms Load: 15.77/10.68/9.93 MMU: 2ms/0.0%, 5ms/57.5%, 10ms/78.7%, 20ms/87.8%, 50ms/93.7%, 100ms/96.8% Mark: 4 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) Relocation: Successful, 867M relocated NMethods: 3209 registered, 1559 unregistered Soft: 466881 encountered, 0 discovered, 0 enqueued Weak: 5421 encountered, 3526 discovered, 1742 enqueued Final: 55 encountered, 6 discovered, 0 enqueued Phantom: 74 encountered, 59 discovered, 0 enqueued Mark Start Mark End Relocate Start Relocate End High Low Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) 126306M (96%) 5866M (4%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) 125134M (95%) 4694M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) - - Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) - - Garbage: - 121623M (93%) 103353M (79%) 127M (0%) - - Reclaimed: - - 18270M (14%) 121496M (93%) - - Garbage Collection (Allocation Rate) 123346M(94%)->4704M(4%) 51
Garbage Collection (Allocation Rate) Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Concurrent Process Non-Strong References 0.367ms Concurrent Reset Relocation Set 18.090ms Concurrent Destroy Detached Pages 0.002ms Concurrent Select Relocation Set 12.295ms Concurrent Prepare Relocation Set 70.922ms Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Pause Relocate Start 1.419ms Concurrent Relocate 645.941ms Load: 15.77/10.68/9.93 MMU: 2ms/0.0%, 5ms/57.5%, 10ms/78.7%, 20ms/87.8%, 50ms/93.7%, 100ms/96.8% Concurrent Process Non-Strong References 0.367ms Mark: 4 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) Relocation: Successful, 867M relocated Concurrent Reset Relocation Set 18.090ms NMethods: 3209 registered, 1559 unregistered Soft: 466881 encountered, 0 discovered, 0 Concurrent enqueued Destroy Detached Pages 0.002ms Weak: 5421 encountered, 3526 discovered, 1742 enqueued Concurrent Select Relocation Set 12.295ms Final: 55 encountered, 6 discovered, 0 enqueued Phantom: 74 encountered, 59 discovered, 0 Concurrent enqueued Prepare Relocation Set 70.922ms Mark Start Mark End Start Relocate End High Low Pause Relocate Start 1.419ms Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) Concurrent 72M Relocate (0%) 645.941ms 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) 126306M (96%) 5866M (4%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) 125134M (95%) 4694M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) - - Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) - - Garbage: - 121623M (93%) 103353M (79%) 127M (0%) - - Reclaimed: - - 18270M (14%) 121496M (93%) - - Garbage Collection (Allocation Rate) 123346M(94%)->4704M(4%) 52
Garbage Collection (Allocation Rate) Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Concurrent Process Non-Strong References 0.367ms Concurrent Reset Relocation Set 18.090ms Concurrent Destroy Detached Pages 0.002ms Concurrent Select Relocation Set 12.295ms Concurrent Prepare Relocation Set 70.922ms Pause Relocate Start 1.419ms Concurrent Relocate 645.941ms Load: 15.77/10.68/9.93 MMU: 2ms/0.0%, 5ms/57.5%, 10ms/78.7%, 20ms/87.8%, 50ms/93.7%, 100ms/96.8% Mark: 4 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) Relocation: Successful, 867M relocated NMethods: 3209 registered, 1559 unregistered Soft: 466881 encountered, 0 discovered, 0 enqueued Weak: 5421 encountered, 3526 discovered, 1742 enqueued Final: 55 encountered, 6 discovered, 0 enqueued Phantom: 74 encountered, 59 discovered, 0 enqueued Mark Start Mark End Relocate Start Relocate End High Low Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) 126306M (96%) 5866M (4%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) 125134M (95%) 4694M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) - - Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) - - Garbage: - 121623M (93%) 103353M (79%) 127M (0%) - - Reclaimed: - - 18270M (14%) 121496M (93%) - - Garbage Collection (Allocation Rate) 123346M(94%)->4704M(4%) Mark Start Mark End Relocate Start Relocate End Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) Garbage: - 121623M (93%) 103353M (79%) 127M (0%) Reclaimed: - - 18270M (14%) 121496M (93%) 53
Garbage Collection (Allocation Rate) Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Concurrent Process Non-Strong References 0.367ms Concurrent Reset Relocation Set 18.090ms Concurrent Destroy Detached Pages 0.002ms Concurrent Select Relocation Set 12.295ms Concurrent Prepare Relocation Set 70.922ms Pause Relocate Start 1.419ms Concurrent Relocate 645.941ms Load: 15.77/10.68/9.93 MMU: 2ms/0.0%, 5ms/57.5%, 10ms/78.7%, 20ms/87.8%, 50ms/93.7%, 100ms/96.8% Mark: 4 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) Relocation: Successful, 867M relocated NMethods: 3209 registered, 1559 unregistered Soft: 466881 encountered, 0 discovered, 0 enqueued Weak: 5421 encountered, 3526 discovered, 1742 enqueued Final: 55 encountered, 6 discovered, 0 enqueued Phantom: 74 encountered, 59 discovered, 0 enqueued Mark Start Mark End Relocate Start Relocate End High Low Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) 126306M (96%) 5866M (4%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) 125134M (95%) 4694M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) - - Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) - - Garbage: - 121623M (93%) 103353M (79%) 127M (0%) - - Reclaimed: - - 18270M (14%) 121496M (93%) - - Garbage Collection (Allocation Rate) 123346M(94%)->4704M(4%) Mark Start Mark End Relocate Start Relocate End Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) Garbage: - 121623M (93%) 103353M (79%) 127M (0%) Reclaimed: - - 18270M (14%) 121496M (93%) 54
Garbage Collection (Allocation Rate) Pause Mark Start 0.949ms Concurrent Mark 1151.425ms Pause Mark End 0.882ms Concurrent Process Non-Strong References 0.367ms Concurrent Reset Relocation Set 18.090ms Concurrent Destroy Detached Pages 0.002ms Concurrent Select Relocation Set 12.295ms Concurrent Prepare Relocation Set 70.922ms Pause Relocate Start 1.419ms Concurrent Relocate 645.941ms Load: 15.77/10.68/9.93 MMU: 2ms/0.0%, 5ms/57.5%, 10ms/78.7%, 20ms/87.8%, 50ms/93.7%, 100ms/96.8% Mark: 4 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) Relocation: Successful, 867M relocated NMethods: 3209 registered, 1559 unregistered Soft: 466881 encountered, 0 discovered, 0 enqueued Weak: 5421 encountered, 3526 discovered, 1742 enqueued Final: 55 encountered, 6 discovered, 0 enqueued Phantom: 74 encountered, 59 discovered, 0 enqueued Mark Start Mark End Relocate Start Relocate End High Low Capacity: 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) 131072M (100%) Reserve: 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) 72M (0%) Free: 7654M (6%) 5898M (4%) 24018M (18%) 126296M (96%) 126306M (96%) 5866M (4%) Used: 123346M (94%) 125102M (95%) 106982M (82%) 4704M (4%) 125134M (95%) 4694M (4%) Live: - 1722M (1%) 1722M (1%) 1722M (1%) - - Allocated: - 1796M (1%) 1962M (1%) 3766M (3%) - - Garbage: - 121623M (93%) 103353M (79%) 127M (0%) - - Reclaimed: - - 18270M (14%) 121496M (93%) - - Garbage Collection (Allocation Rate) 123346M(94%)->4704M(4%) 55
GC Statistics === Garbage Collection Statistics ======================================================================================================================= Last 10s Last 10m Last 10h Total Avg / Max Avg / Max Avg / Max Avg / Max Collector: Garbage Collection Cycle 1906.804 / 1906.804 1871.019 / 2184.368 2764.747 / 4655.377 2764. 747 / 4655.377 ms Contention: Mark Segment Reset Contention 3 / 24 0 / 34 0 / 73 0 / 73 ops/s Contention: Mark SeqNum Reset Contention 0 / 0 0 / 0 0 / 2 0 / 2 ops/s Contention: Relocation Contention 27 / 275 9 / 1137 14 / 9460 14 / 9460 ops/s Critical: Allocation Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: Allocation Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Critical: GC Locker Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: GC Locker Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Allocation Rate 1458 / 1672 1089 / 1904 1679 / 7914 1 679 / 7914 MB/s Memory: Heap Used After Mark 125102 / 125102 97411 / 125102 70566 / 125102 70 566 / 125102 MB Memory: Heap Used After Relocation 4704 / 4704 4019 / 4814 17042 / 34092 17 042 / 34092 MB Memory: Heap Used Before Mark 123346 / 123346 95981 / 123346 61669 / 123346 61 669 / 123346 MB Memory: Heap Used Before Relocation 106982 / 106982 85095 / 106982 60136 / 106982 60 136 / 106982 MB Memory: Out Of Memory 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Page Cache Flush 0 / 0 0 / 0 0 / 0 0 / 0 MB/s Memory: Page Cache Hit L1 710 / 1037 499 / 1037 771 / 3777 771 / 3777 ops/s Memory: Page Cache Hit L2 12 / 77 3 / 179 5 / 517 5 / 517 ops/s Memory: Page Cache Miss 8 / 81 19 / 651 29 / 1932 29 / 1932 ops/s Memory: Undo Object Allocation Failed 1 / 12 0 / 18 0 / 64 0 / 64 ops/s Memory: Undo Object Allocation Succeeded 26 / 263 9 / 1137 13 / 9460 13 / 9460 ops/s Memory: Undo Page Allocation 3 / 30 5 / 249 9 / 1027 9 / 1027 ops/s Phase: Concurrent Destroy Detached Pages 0.002 / 0.002 0.001 / 0.002 0.041 / 2.230 0. 041 / 2.230 ms Phase: Concurrent Mark 1151.425 / 1151.425 1163.417 / 1452.750 1584.987 / 3028.289 1584. 987 / 3028.289 ms Phase: Concurrent Mark Continue 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Phase: Concurrent Prepare Relocation Set 70.922 / 70.922 67.627 / 74.532 81.298 / 374.926 81. 298 / 374.926 ms Phase: Concurrent Process Non-Strong References 0.367 / 0.367 0.391 / 0.463 0.394 / 0.774 0.394 / 0.774 ms Phase: Concurrent Relocate 645.941 / 645.941 602.340 / 645.941 1051.985 / 2198.100 1051. 985 / 2198.100 ms Phase: Concurrent Reset Relocation Set 18.090 / 18.090 13.636 / 18.090 11.832 / 28.342 11. 832 / 28.342 ms Phase: Concurrent Select Relocation Set 12.295 / 12.295 15.162 / 28.735 20.960 / 57.464 20. 960 / 57.464 ms Phase: Pause Mark End 0.882 / 0.882 0.997 / 1.095 0.941 / 1.199 0. 941 / 1.199 ms Phase: Pause Mark Start 0.949 / 0.949 0.875 / 0.983 0.832 / 1.013 0. 832 / 1.013 ms Phase: Pause Relocate Start 1.419 / 1.419 1.532 / 2.091 1.474 / 2.127 1. 474 / 2.127 ms Subphase: Concurrent Mark 1151.055 / 1151.287 1162.724 / 1452.499 1059.510 / 3028.035 1059. 510 / 3028.035 ms Subphase: Concurrent Mark Idle 1.058 / 1.060 1.088 / 2.320 2.727 / 22.115 2. 727 / 22.115 ms Subphase: Concurrent Mark Try Flush 0.779 / 1.862 Copyright 2018, 0.603 Oracle / and/or 5.829 its affiliates. All rights 8.556 reserved. / 50.035 8.556 / 50.035 ms Subphase: Concurrent Mark Try Terminate 0.849 / 1.062 0.940 / 2.321 2.766 / 45.114 2. 766 / 45.114 ms 56
=== Garbage Collection Statistics ======================================================================================================================= Last 10s Last 10m Last 10h Total Avg / Max Avg / Max Avg / Max Avg / Max Collector: Garbage Collection Cycle 1906.804 / 1906.804 1871.019 / 2184.368 2764.747 / 4655.377 2764. 747 / 4655.377 ms Contention: Mark Segment Reset Contention 3 / 24 0 / 34 0 / 73 0 / 73 ops/s Contention: Mark SeqNum Reset Contention 0 / 0 0 / 0 0 / 2 0 / 2 ops/s Contention: Relocation Contention 27 / 275 9 / 1137 14 / 9460 14 / 9460 ops/s Critical: Allocation Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: Allocation Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Critical: GC Locker Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: GC Locker Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Allocation Rate 1458 / 1672 1089 / 1904 1679 / 7914 1 679 / 7914 MB/s Memory: Heap Used After Mark 125102 / 125102 97411 / 125102 70566 / 125102 70 566 / 125102 MB Memory: Heap Used After Relocation 4704 / 4704 4019 / 4814 17042 / 34092 17 042 / 34092 MB Memory: Heap Used Before Mark 123346 / 123346 95981 / 123346 61669 / 123346 61 669 / 123346 MB Memory: Heap Used Before Relocation 106982 / 106982 85095 / 106982 60136 / 106982 60 136 / 106982 MB Memory: Out Of Memory 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Page Cache Flush 0 / 0 0 / 0 0 / 0 0 / 0 MB/s Memory: Page Cache Hit L1 710 / 1037 499 / 1037 771 / 3777 771 / 3777 ops/s Memory: Page Cache Hit L2 12 / 77 3 / 179 5 / 517 5 / 517 ops/s Memory: Page Cache Miss 8 / 81 19 / 651 29 / 1932 29 / 1932 ops/s Memory: Undo Object Allocation Failed 1 / 12 0 / 18 0 / 64 0 / 64 ops/s Memory: Undo Object Allocation Succeeded 26 / 263 9 / 1137 13 / 9460 13 / 9460 ops/s Memory: Undo Page Allocation 3 / 30 5 / 249 9 / 1027 9 / 1027 ops/s Phase: Concurrent Destroy Detached Pages 0.002 / 0.002 0.001 / 0.002 0.041 / 2.230 0. 041 / 2.230 ms Phase: Concurrent Mark 1151.425 / 1151.425 1163.417 / 1452.750 1584.987 / 3028.289 1584. 987 / 3028.289 ms Phase: Concurrent Mark Continue 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Phase: Concurrent Prepare Relocation Set 70.922 / 70.922 67.627 / 74.532 81.298 / 374.926 81. 298 / 374.926 ms Phase: Concurrent Process Non-Strong References 0.367 / 0.367 0.391 / 0.463 0.394 / 0.774 0.394 / 0.774 ms Phase: Concurrent Relocate 645.941 / 645.941 602.340 / 645.941 1051.985 / 2198.100 1051. 985 / 2198.100 ms Phase: Concurrent Reset Relocation Set 18.090 / 18.090 13.636 / 18.090 11.832 / 28.342 11. 832 / 28.342 ms Phase: Concurrent Select Relocation Set 12.295 / 12.295 15.162 / 28.735 20.960 / 57.464 20. 960 / 57.464 ms Phase: Pause Mark End 0.882 / 0.882 0.997 / 1.095 0.941 / 1.199 0. 941 / 1.199 ms Phase: Pause Mark Start 0.949 / 0.949 0.875 / 0.983 0.832 / 1.013 0. 832 / 1.013 ms Phase: Pause Relocate Start 1.419 / 1.419 1.532 / 2.091 1.474 / 2.127 1. 474 / 2.127 ms... 57
=== Garbage Collection Statistics ======================================================================================================================= Last 10s Last 10m Last 10h Total Avg / Max Avg / Max Avg / Max Avg / Max Collector: Garbage Collection Cycle 1906.804 / 1906.804 1871.019 / 2184.368 2764.747 / 4655.377 2764. 747 / 4655.377 ms Contention: Mark Segment Reset Contention 3 / 24 0 / 34 0 / 73 0 / 73 ops/s Contention: Mark SeqNum Reset Contention 0 / 0 0 / 0 0 / 2 0 / 2 ops/s Contention: Relocation Contention 27 / 275 9 / 1137 14 / 9460 14 / 9460 ops/s Critical: Allocation Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: Allocation Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Critical: GC Locker Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: GC Locker Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Allocation Rate 1458 / 1672 1089 / 1904 1679 / 7914 1 679 / 7914 MB/s Memory: Heap Used After Mark 125102 / 125102 97411 / 125102 70566 / 125102 70 566 / 125102 MB Memory: Heap Used After Relocation 4704 / 4704 4019 / 4814 17042 / 34092 17 042 / 34092 MB Memory: Heap Used Before Mark 123346 / 123346 95981 / 123346 61669 / 123346 61 669 / 123346 MB Memory: Heap Used Before Relocation 106982 / 106982 85095 / 106982 60136 / 106982 60 136 / 106982 MB Memory: Out Of Memory 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Memory: Page Cache Flush 0 / 0 0 / 0 0 / 0 0 / 0 MB/s Memory: Page Cache Hit L1 710 / 1037 499 / 1037 771 / 3777 771 / 3777 ops/s Memory: Page Cache Hit L2 12 / 77 3 / 179 5 / 517 5 / 517 ops/s Memory: Page Cache Miss Last 10s 8 / 81 Last 10m 19 / 651 Last 29 / 10h 1932 29 / 1932 Total ops/s Memory: Undo Object Allocation Failed 1 / 12 0 / 18 0 64 0 / 64 ops/s Memory: Undo Object Allocation Succeeded Avg / Max 26 / 263 Avg / Max 9 / 1137 Avg 13 / 9460 Max 13 / 9460 Avg / Max ops/s Memory: Undo Page Allocation 3 / 30 5 / 249 9 / 1027 9 / 1027 ops/s Phase: Concurrent Destroy Detached Pages 0.002 / 0.002 0.001 / 0.002 0.041 / 2.230 0. 041 / 2.230 ms Phase: Concurrent Mark 1151.425 / 1151.425 1163.417 / 1452.750 1584.987 / 3028.289 1584. 987 / 3028.289 ms Phase: Concurrent Mark Continue 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Phase: Concurrent Prepare Relocation Set 70.922 / 70.922 67.627 / 74.532 81.298 / 374.926 81. 298 / 374.926 ms Phase: Concurrent Process Non-Strong References 0.367 / 0.367 0.391 / 0.463 0.394 / 0.774 0.394 / 0.774 ms Phase: Concurrent Relocate 645.941 / 645.941 602.340 / 645.941 1051.985 / 2198.100 1051. 985 / 2198.100 ms Phase: Concurrent Reset Relocation Set 18.090 / 18.090 13.636 / 18.090 11.832 / 28.342 11. 832 / 28.342 ms Phase: Concurrent Select Relocation Set 12.295 / 12.295 15.162 / 28.735 20.960 / 57.464 20. 960 / 57.464 ms Phase: Pause Mark End 0.882 / 0.882 0.997 / 1.095 0.941 / 1.199 0. 941 / 1.199 ms Phase: Pause Mark Start 0.949 / 0.949 0.875 / 0.983 0.832 / 1.013 0. 832 / 1.013 ms Phase: Pause Relocate Start 1.419 / 1.419 1.532 / 2.091 1.474 / 2.127 1. 474 / 2.127 ms... Allocation Rate 1458 / 1672 1089 / 1904 1679 / 7914 1679 / 7914 MB/s 58
=== Garbage Collection Statistics ======================================================================================================================= Last 10s Last 10m Last 10h Total Avg / Max Avg / Max Avg / Max Avg / Max Collector: Garbage Collection Cycle 1906.804 / 1906.804 1871.019 / 2184.368 2764.747 / 4655.377 2764. 747 / 4655.377 ms Contention: Mark Segment Reset Contention 3 / 24 0 / 34 0 / 73 0 / 73 ops/s Contention: Mark SeqNum Reset Contention 0 / 0 0 / 0 0 / 2 0 / 2 ops/s Contention: Relocation Contention 27 / 275 9 / 1137 14 / 9460 14 / 9460 ops/s Critical: Allocation Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: Allocation Stall 0 / 0 0 / 0 0 / 0 0 / 0 ops/s Critical: GC Locker Stall 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Critical: GC Locker Stall Last 10s 0 / 0 Last 10m 0 / 0 Last 0 / 010h 0 / 0 Totalops/s Memory: Allocation Rate 1458 / 1672 1089 / 1904 1679 / 7914 1 679 / 7914 MB/s Memory: Heap Used After Mark Avg / Max 125102 / 125102 Avg / 97411 Max / 125102 70566 Avg / / 125102 Max 70 566 / 125102 Avg / Max MB Memory: Heap Used After Relocation 4704 / 4704 4019 / 4814 17042 / 34092 17 042 / 34092 MB Memory: Heap Used Before Mark 123346 / 123346 95981 / 123346 61669 / 123346 61 669 / 123346 MB Pause Memory: Mark End Heap Used Before Relocation 0.882 / 0.882106982 / 106982 0.997 / 85095 1.095 / 106982 0.941 60136 / / 106982 1.199 60 136 / 0.941 106982 / 1.199 MB ms Pause Memory: Mark Start Out Of Memory 0.949 / 0.949 0 / 0 0.875 / 0.983 0 / 0 0.832 0 / / 0 1.013 0 / 0.8320 / 1.013 ops/s ms Pause Memory: Relocate Page Cache Start Flush 1.419 / 1.419 0 / 0 1.532 / 2.0910 / 0 1.474 0 / / 0 2.127 0 / 1.474 0 / 2.127 MB/s Memory: Page Cache Hit L1 710 / 1037 499 / 1037 771 / 3777 771 / 3777 ops/s ms Memory: Page Cache Hit L2 12 / 77 3 / 179 5 / 517 5 / 517 ops/s Memory: Page Cache Miss 8 / 81 19 / 651 29 / 1932 29 / 1932 ops/s Memory: Undo Object Allocation Failed 1 / 12 0 / 18 0 / 64 0 / 64 ops/s Memory: Undo Object Allocation Succeeded 26 / 263 9 / 1137 13 / 9460 13 / 9460 ops/s Memory: Undo Page Allocation 3 / 30 5 / 249 9 / 1027 9 / 1027 ops/s Phase: Concurrent Destroy Detached Pages 0.002 / 0.002 0.001 / 0.002 0.041 / 2.230 0. 041 / 2.230 ms Phase: Concurrent Mark 1151.425 / 1151.425 1163.417 / 1452.750 1584.987 / 3028.289 1584. 987 / 3028.289 ms Phase: Concurrent Mark Continue 0.000 / 0.000 0.000 / 0.000 0.000 / 0.000 0. 000 / 0.000 ms Phase: Concurrent Prepare Relocation Set 70.922 / 70.922 67.627 / 74.532 81.298 / 374.926 81. 298 / 374.926 ms Phase: Concurrent Process Non-Strong References 0.367 / 0.367 0.391 / 0.463 0.394 / 0.774 0.394 / 0.774 ms Phase: Concurrent Relocate 645.941 / 645.941 602.340 / 645.941 1051.985 / 2198.100 1051. 985 / 2198.100 ms Phase: Concurrent Reset Relocation Set 18.090 / 18.090 13.636 / 18.090 11.832 / 28.342 11. 832 / 28.342 ms Phase: Concurrent Select Relocation Set 12.295 / 12.295 15.162 / 28.735 20.960 / 57.464 20. 960 / 57.464 ms Phase: Pause Mark End 0.882 / 0.882 0.997 / 1.095 0.941 / 1.199 0. 941 / 1.199 ms Phase: Pause Mark Start 0.949 / 0.949 0.875 / 0.983 0.832 / 1.013 0. 832 / 1.013 ms Phase: Pause Relocate Start 1.419 / 1.419 1.532 / 2.091 1.474 / 2.127 1. 474 / 2.127 ms... 59
Future Plans 60
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature 61
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Available today in the ZGC development repository! 62
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Remove experimental status 63
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature 64
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Long-term Generational Sub-millisecond max pause times Additional platform support Graal JIT support 65
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Generational Withstand higher allocation rates Lower heap overhead Lower CPU usage Long-term Generational Sub-millisecond max pause times Additional platform support Graal JIT support 66
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Sub-millisecond max pause times Within reach Reduce root set size Time-to-Safepoint, etc Long-term Generational Sub-millisecond max pause times Additional platform support Graal JIT support 67
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Long-term Generational Sub-millisecond max pause times Additional platform support Graal JIT support Additional platform support macos? Windows? Sparc? Aarch64? 68
Future Plans Short-term Concurrent class unloading Turn ZGC into a product feature Long-term Generational Sub-millisecond max pause times Additional platform support Graal JIT support 69
Get Involved! 70
ZGC Project Follow, Participate, Give Feedback zgc-dev@openjdk.java.net http://wiki.openjdk.java.net/display/zgc/main 71
ZGC Project Source Code http://hg.openjdk.java.net/jdk/jdk http://hg.openjdk.java.net/zgc/zgc 72
Thanks! 73
Questions? 74