A floating proposal in the Java community would improve application performance by extending the ZGC (Z Garbage Collector) to maintain separate generations for young and old objects. This would allow ZGC to more frequently collect young objects, which tend to die young, the Java developers said.
Specific goals of OpenJDK Java Enhancement Proposal (JEP) for Generational ZGC include reduced risk of allocation blocking, reduced required heap memory overhead, and reduced garbage collection CPU overhead. These benefits are expected to come without a significant reduction in throughput compared to non-generational ZGC, the proposal states.
Designed for scalability and low latency, ZGC has been available in production since Java Development Kit (JDK) 15 in September 2020. With ZGC, most work is done with running application threads. Dwell times for ZGC are consistently measured in microseconds, while dwell times for the default G1 collector range from milliseconds to seconds. Thus, for many workloads, ZGC can solve latency issues related to garbage collection, the proposal says.
ZGC works well when there are enough resources. But because ZGC stores all objects together, regardless of their age, it must collect all objects each time it runs. Because young objects tend to die young, while older objects tend to stay (depending on the weak generational hypothesis), collecting young objects requires fewer resources and generates more memory, while collecting old objects requires more resources and generates less memory.
Gen ZGC is currently not designated for a specific version of standard Java. The current version, JDK 20arrived a week ago while the next version, JDK 21, is scheduled for September. Standard Java is on a six month release cadence.
Copyright © 2023 IDG Communications, Inc.