Summary
The proposed change deprecates the use of non-generational ZGC by doing the following: 1. Switch the default value of the flag ZGenerational
to true
and 2. deprecate the flag ZGenerational
.
Problem
Maintaining two different modes of ZGC comes at a cost. As a step in reducing the future maintenance burden and technical debt the non-generational mode of ZGC will be phased out through the deprecation process.
For more details see JEP 474: ZGC: Generational Mode by Default
(JDK-8326667).
Solution
JEP 439: https://openjdk.org/jeps/439 introduced Generational ZGC as a second mode of ZGC to allow for a smoother transition for users from the non-generational ZGC. As the next step in phasing out non-generational ZGC the Generational mode will be made the default mode of ZGC and the flag ZGenerational
deprecated.
This will entail switching the default value of the flag ZGenerational
to true
and deprecating ZGenerational
via the standard HotSpot Command-line Flag lifecycle process.
For more details see JEP 474: ZGC: Generational Mode by Default
(JDK-8326667).
Specification
Draft PR: https://github.com/openjdk/jdk/pull/18393
The switch of the default value of ZGenerational
will change the behavior for users which only specify -XX:+UseZGC
in the following way.
- All product flags (except
ZGenerational
) will have similar behavior- The flag
ZCollectionInterval
can be specified with finer granularity via:ZCollectionIntervalMinor
- "Force Minor GC at a fixed time interval (in seconds)"ZCollectionIntervalMajor
- "Force GC at a fixed time interval (in seconds)"
- The flag
ConcGCThreads
can be specified with generational granularity via:ZYoungGCThreads
- "Number of GC threads for the young generation"ZOldGCThreads
- "Number of GC threads for the old generation"
- The flag
ZFragmentationLimit
is used for the old generation, young generations is configured via:ZYoungCompactionLimit
- "Maximum allowed garbage in young pages"
- The flag
Because Generational ZGC has two generations and the non-generational ZGC only has one, there will be a difference in the number entities in various serviceability layers:
Memory Pools:
- Non-generational ZGC: "ZHeap"
- Generational ZGC: "ZGC Young Generation", "ZGC Old Generation"
Memory Managers:
- Non-generational 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.
The deprecation of ZGenerational
will cause a deprecation message to be printed when the JVM starts with the flag ZGenerational
set to a value.
- csr of
-
JDK-8326957 Implement JEP 474: ZGC: Generational Mode by Default
- Resolved
- relates to
-
JDK-8326667 JEP 474: ZGC: Generational Mode by Default
- Closed