Java11 引入的 Z 垃圾收集器的稳定性如何?

How stable is Z Garbage Collector introduced with Java11?

我正在使用 Java 11,新的 Z 垃圾收集器 (ZGC) 看起来很有前途。

文档说它使用了一些低延迟垃圾收集机制,这样 GC 暂停时间永远不会超过 10 ms,非常好地处理大堆并允许 return 未使用的堆内存到 OS,旧 GC 不存在

我担心的是 - ZGC 的稳定性如何?如果在产品中继续使用它是否存在风险?

谢谢!

ZGC 仍是一项实验性功能。使其成为产品功能是 planned for JDK 15.

根据JEP 377页面(2020/05/25更新):

Since its introduction in JDK 11 we’ve received positive feedback, we’ve ironed out many bugs, and we’ve added a number of features and enhancements. To highlight some of the more important ones:

  • Concurrent class unloading
  • Uncommitting unused memory (JEP 351)
  • Maximum heap size increased from 4TB to 16TB
  • Minimum heap size decreased to 8MB
  • -XX:SoftMaxHeapSize
  • Support for the JFR leak profiler
  • Support for class-data sharing
  • Limited and discontiguous address spaces
  • Support for placing the heap on NVRAM
  • Improved NUMA awareness
  • Multi-threaded heap pre-touching

Furthermore, all commonly used platforms are now supported:

  • Linux/x86_64 (JEP 333)
  • Linux/aarch64 (8214527)
  • Windows (JEP 365)
  • macOS (JEP 364)

Testing of ZGC suggests that it is stable and, as of this writing, we have received no new ZGC-specific bugs for a few months. With the stability, feature set, and platform support that ZGC has today, it is time to remove its experimental status and make it a product feature.

一些注意事项:

  • 这来自从事 ZGC 项目的团队。有可能它们并不完全 objective。 (那只是人性...)。
  • 这取决于有多少人(团队和用户)正在测试/尝试新的 GC。
  • 这取决于他们正在测试/尝试的内容,以及这是否适合您的计划。
  • 对于像新的 Java GC 这样复杂的东西,它 可能 需要 才能在可重现的环境中出现一些错误形式。

因此,虽然很有希望,但这并不能算作 可量化的 稳定性衡量标准,也不能给出可量化的风险衡量标准。