I wonder what the official status of the "garbage first" (G1) collector in the JDK 7 release is. I would like to use G1 as a low pause gc alternative to CMS, but only if I can really trust on its robustness.
Before JDK 7 was out, G1 was advertised as the shiny new gc going to replace the CMS collector and even to be the default gc in JDK 7. However, now with Oracle JDK 7u1, G1 is not the default gc on any machine I have tried.
Even though one does not need to specify -XX:+UnlockExperimentalVMOptions
anymore when using -XX:+UseG1GC
in JDK 7, it's a JVM feature that's officially completely undocumented:
Java 7 (JDK 7) garbage collection and documentation on G1
The only official document I could find that mentions G1 is seriously outdated and was written long before JDK 7 was out:
http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html
For example, the official "Java HotSpot VM Options" documentation ( http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html ) documents how to enable and tune the other collectors but does not even mention the existence of G1. As if it didn't exist!
This is quite confusing and I wonder what the real status of the G1 and what its future is. Is it really stable yet? Have the remaining issues (like leaks, spurious crashes and missing instrumentation support) been resolved? And if so, why does Oracle treat the G1GC as an undocumented (embarrassing?) secret? Is G1 perhaps a failed project that's now silently discontinued? Or do I need to pay for documentation and support? Or is it just still beta? Can someone enlighten me on what's going on here?
For example on Java 8, the default GC is Parallel GC, while on Java 11 the default is G1 GC. This means that on upgrading your Java version, this will be changed on your behalf, for better or worse, unless you've explicitly set the GC.
Since OpenJDK 11 released the experimental ZGC, the stability of the ZGC has been enhanced, and its functions have been improved. ZGC had become a production-ready feature by the time OpenJDK 15 was released.
Comparing G1 with CMS reveals differences that make G1 a better solution. One difference is that G1 is a compacting collector. Also, G1 offers more predictable garbage collection pauses than the CMS collector, and allows users to specify desired pause targets.
The G1 GC uses concurrent and parallel phases to achieve its target pause time and to maintain good throughput.
The place to ask this question is on the hotspot-gc-dev mailing list.
If you look through the archives you'll find that there is a lot of work being done. A lot of the mail appears to be commits and review requests/comments so they're busy working on it.
I haven't found any official news announcements, but that is how Oracle works. You might be able to ask on that mailing list how they think they're going, if you're happy with an unofficial and non-binding comment from one of the devs.
EDIT: @scravy sent an email to the mailing list, this is the response received:
I don't think there is a simple answer to this question, though probably not. G1's initial focus was to provide reasonable pauses for extremely large heaps. Which means today it might not be the best choice for everyone. We think the technology has 'a lot of legs' though, meaning that with adaptation, it can address many different kinds of garbage collection demands. So one day, it might effectively be the default collector, but it is too soon to know for sure.
Considering that GC behavior changes can be very disruptive to existing deployments, we are reluctant to make shifts like this even in major releases without considerable advanced notice. So in current releases, if you don't specify a collector, we attempt to make some simple automated choices, but I doubt we'd make radical changes to that behavior in the near term.
For the bigger question regarding is G1 supported, the current answer is no. But keep in mind that the support commitment that Oracle makes to its paid customers for supported products is fairly significant, and there is much more to it than just meeting the functionality and reliability requirements.
We continue to encourage everyone to test and evaluate G1, and of course, deliver feedback to us, as we continue significant development on G1.
-John
EDIT: According to this link on Oracle's site it looks like G1GC is now fully supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With