G1GC还没有正式量产吗?

发布于 2024-12-19 17:26:35 字数 1192 浏览 1 评论 0原文

我想知道 JDK 7 版本中“垃圾优先”(G1)收集器的官方地位是什么。我想使用 G1 作为 CMS 的低暂停 gc 替代品,但前提是我真正信任它的稳健性。

在 JDK 7 发布之前,G1 被宣传为闪亮的新 gc 将取代 CMS 收集器,甚至成为 JDK 7 中的默认 gc。但是,现在使用 Oracle JDK 7u1,G1 不再是我拥有的任何计算机上的默认 gc尝试过。

尽管在 JDK 7 中使用 -XX:+UseG1GC 时不再需要指定 -XX:+UnlockExperimentalVMOptions,但它是一项官方完全未记录的 JVM 功能:

Java 7(JDK 7) G1 上的垃圾收集和文档

我能找到的唯一提到 G1 的官方文档已经严重过时了,并且是在 JDK 7 发布之前很久就编写的:

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

例如,官方的“Java HotSpot VM Options”文档( http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html )记录了如何启用和调整其他收集器,但甚至没有提及G1。就好像它不存在一样!

这是相当令人困惑的,我想知道G1的真实状况是什么以及它的未来是什么。真的还稳定吗?剩下的问题(例如泄漏、虚假崩溃和缺少仪器支持)是否得到解决?如果是这样,为什么 Oracle 将 G1GC 视为未记录的(令人尴尬的?)秘密? G1 或许是一个失败的项目,现在已经悄然中止了?或者我需要支付文档和支持费用吗?或者它还只是测试版?有人可以告诉我这里发生了什么吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

去了角落 2024-12-26 17:26:35

提出这个问题的地方是 hotspot-gc-dev 邮件列表。

如果您查看档案,您会发现有一个很多工作正在进行中。很多邮件似乎都是提交和审查请求/评论,因此他们正忙于处理它。

我没有找到任何官方新闻公告,但这就是Oracle的运作方式。如果您对其中一位开发人员的非官方且不具约束力的评论感到满意,您可以在该邮件列表上询问他们认为进展如何。

编辑:@scravy发送一封电子邮件发送到邮件列表,这是收到回复

不过,我认为这个问题没有一个简单的答案
可能不会。 G1 最初的重点是提供合理的暂停
对于非常大的堆。这意味着今天可能不是
每个人的最佳选择。我们认为这项技术有“很多
不过,这意味着通过适应,它可以解决许多问题
不同类型的垃圾收集需求。于是有一天,它
可能实际上是默认收集器,但现在还为时过早
确实知道。

考虑到 GC 行为的变化可能会对
现有的部署,我们不愿意做出这样的转变
即使在没有相当提前通知的主要版本中也是如此。因此,在当前版本中,如果您
不指定收集器,我们尝试做一些简单的
自动选择,但我怀疑我们会对此做出根本性的改变
近期行为。

关于是否支持 G1 的更大问题,当前
答案是否定的。但请记住,支持承诺
Oracle 向其付费客户提供的支持产品是
相当重要,而且不仅仅是会面
功能和可靠性要求。

我们继续鼓励大家测试和评估 G1,并且
当然,在我们继续重要的过程中向我们提供反馈
G1 上的开发。

-约翰

编辑:根据 Oracle 网站上的此链接 看起来 G1GC 现在已经完全支持了。

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.

迷迭香的记忆 2024-12-26 17:26:35

我们已经使用 G1GC 近一年半了。它在我们的关键任务事务处理系统中表现出色,并且事实证明它对高吞吐量、低暂停、并发、多线程和优化的重内存管理提供了很好的支持。

我们使用以下 JVM 设置:

-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

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 w.r.t 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
2024-12-26 17:26:35

据此: http://www.oracle .com/technetwork/java/javase/tech/g1-intro-jsp-135488.html,

G1 开发现在主要集中于解决任何剩余的问题
可靠性问题和提高性能

此外,

就GC停顿时间而言,G1有时更好,有时更差
比CMS。我们正在进行工作,以使 G1 始终如一,即使不是
比 CMS 更好。

因此,当官方 JDK SE 7 发布时,G1 应该会取代 CMS。

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.

夜雨飘雪 2024-12-26 17:26:35

AFAIK,G1 并不是秘密——它已经开放供实验使用足够长的时间——至少一两年。每个 JavaOne 都带有一些关于 G1 有多好的文章:)

来自非官方来源:它是 java 工程师当前关注的焦点之一,最终使 G1 生产做好准备。他们只是还没有准备好为 JDK 7 打开它。请继续等待:)

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 :)

小…红帽 2024-12-26 17:26:35

它看起来像问题中链接的页面 已更新:

Oracle 完全支持垃圾优先 (G1) 垃圾收集器
JDK 7 update 4 及更高版本。

(但请注意,对于像 ARM 这样的嵌入式平台,7u4 中尚不支持它。)

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.)

漫漫岁月 2024-12-26 17:26:35

自 Java 7 update 4 版本发布以来,G1 GC 已做好生产准备。

从 oracle 文章(在 G1 垃圾收集器下),您可以找到G1 GC 的真实用例。

如果应用程序具有以下一个或多个特征,则当前使用 CMS 或 ParallelOldGC 垃圾收集器运行的应用程序将有利于切换到 G1。

  1. Full GC 持续时间太长或太频繁。
  2. 对象分配率或提升率差异很大。
  3. 不需要的长时间垃圾收集或压缩暂停(超过 0.5 到 1 秒)

查看相关问题,了解有关 G1GC 的更多详细信息以及需要微调的关键参数:

Java 7 (JDK 7) 垃圾关于 G1 的收集和文档

关于您的其他疑问:

真的稳定了吗?剩下的问题(例如泄漏、虚假崩溃和缺少仪器支持)是否得到解决?如果是这样,为什么 Oracle 将 G1GC 视为未记录的(令人尴尬的?)秘密? G1 或许是一个失败的项目,现在已经悄然中止了?或者我需要支付文档和支持费用吗?或者它还只是测试版?有人可以告诉我这里发生了什么吗?

  1. G1GC稳定。
  2. 我还没有发现这个算法有任何漏洞。
  3. Oracle 并没有将其保留在文档中。您可以在此处此处
  4. G1 不是一个失败的项目,并且G1GC 将成为较新版本的 java 中的默认 GC 算法(java 9)
  5. 您无需支付支持费用。这不是测试版。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文