Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8307059

Implementation of Generational ZGC

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 21
    • hotspot
    • None
    • gc
    • behavioral
    • low
    • When running with -XX:+ZGenerational, serviceability like memory pools and memory counters will not report new names and metrics.
    • add/remove/modify command line option
    • Implementation

    Description

      Summary

      The proposed change introduces a new version of ZGC, named Generational ZGC. This version of ZGC can be turned on with the new product flag -XX:+ZGenerational.

      Problem

      We want to improve application performance by extending the Z Garbage Collector (ZGC) to maintain separate generations for young and old objects. This will allow ZGC to collect young objects — which tend to die young — more frequently.

      For more details see JEP 439: https://openjdk.org/jeps/439

      Solution

      The JEP describes the new Generational ZGC.

      Our first suggested approach was to remove the old ZGC code and replace it with the new, Generational ZGC. However, different GC implementations have different performance characteristics, which could effect some current users. Therefore it was decided that that we should keep both versions in, at least, the release where Generational ZGC is introduced. The intention is to pave the way for a smoother transition of users from the old ZGC to the new Generational ZGC.

      User running with -XX:+UseZGC will get the old ZGC version. Users running with -XX:+UseZGC -XX:+ZGenerational will get the new Generational ZGC.

      Specification

      Generational ZGC code: https://github.com/openjdk/zgc/tree/zgc_generational

      This is the version where we retain the old version: https://github.com/stefank/jdk/tree/zgc_generational_include_single_gen_code_as_x

      When -XX:+ZGenerational is used the GC will react to a few new product flags:

      • -XX:ZYoungCompactionLimit - "Maximum allowed garbage in young pages" - Default: 25.0 (range between 0-100%)
      • -XX:ZCollectionIntervalMinor - "Force Minor GC at a fixed time interval (in seconds)" - The flag is ignored unless the user sets it.
      • -XX:ZCollectionIntervalMajor - "Force GC at a fixed time interval (in seconds)" - The flag is ignored unless the user sets it.
      • -XX:ZYoungGCThreads - "Number of GC threads for the young generation" - The value of this flag is set ergonomically if the user didn't set the flag.
      • -XX:ZOldGCThreads - "Number of GC threads for the old generation" - The value of this flag is set ergonomically if the user didn't set the flag.

      Because Generational ZGC has two generations and the old ZGC only had one, there will be a difference in the number entities in various serviceability layers:

      Memory Pools:

      • Old ZGC: "ZHeap"
      • Generational ZGC: "ZGC Young Generation", "ZGC Old Generation"

      Memory Managers:

      • Old ZGC: "ZGC Cycles", "ZGC Pauses"
      • Generational ZGC: "ZGC Minor Cycles", "ZGC Minor Pauses", "ZGC Major Cycles", "ZGC Major Pauses"

      The same is true for the HotSpot performance counters.

      Attachments

        Issue Links

          Activity

            People

              stefank Stefan Karlsson
              stefank Stefan Karlsson
              Axel Boldt-Christmas, Erik Österlund, Vladimir Kozlov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: