简体   繁体   中英

Is G1GC still not officially production ready?

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?

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.

We are already using G1GC, from almost a year and half. Its doing great in our mission critical transaction processing system, and It proved to be a great support wrt high throughput, low pause, concurrency, multi-threading and optimized heavy memory management.

We are using following JVM settings:

-server -d64 -Xms512m -Xmx3072m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC
-XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis
-XX:MaxGCPauseMillis=400 -XX:GCPauseIntervalMillis=8000 
-XX:+UseCompressedOops -XX:NewRatio=50

According to this: http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html ,

G1 development is now focused primarily on resolving any remaining reliability issues and improving performance

Also,

In terms of GC pause times, G1 is sometimes better and sometimes worse than CMS. Work is ongoing to make G1 consistently as good as, if not better than, CMS.

So G1 is supposedly going to replace CMS when the official JDK SE 7 is out.

It looks like the page linked in the question has been updated:

The Garbage-First (G1) garbage collector is fully supported in Oracle JDK 7 update 4 and later releases.

(Note, however, that for embedded platforms like ARM, it is not yet supported at all in 7u4.)

G1 GC is production ready since Java 7 update 4 version launch.

From oracle article (under The G1 Garbage Collector), you can find real use cases for G1 GC.

Applications running today with either the CMS or the ParallelOldGC garbage collector would benefit switching to G1 if the application has one or more of the following traits.

  1. Full GC durations are too long or too frequent.
  2. The rate of object allocation rate or promotion varies significantly.
  3. Undesired long garbage collection or compaction pauses (longer than 0.5 to 1 second)

Have a look at related question for more details about G1GC and key parameters to be fine tuned:

Java 7 (JDK 7) garbage collection and documentation on G1

Regarding your other queries:

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?

  1. G1GC is stable.
  2. I have not found any leaks in this algorithm.
  3. Oracle did not keep it undocumented. You can find more info about G1GC here and here
  4. G1 is not a failed project and G1GC is going to be default GC algorithm in newer versions of java ( java 9 )
  5. You don't need to pay for support. It's not beta.

AFAIK, G1 is not secret -- it's open for experimental use long enough -- at least year or two. Every JavaOne comes with some lection about how good G1 will be :)

From unofficial sources: it's one of current focuses for java engeneers, to make G1 production ready at last. They just was not ready to open it for JDK 7. Just keep waiting :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM