Skip to content
欢迎扫码关注公众号

JEP 490: ZGC: Remove the Non-Generational Mode | ZGC:移除非分代模式

摘要

移除 Z 垃圾收集器(ZGC)的非分代模式,保留分代模式作为 ZGC 的默认模式。

目标

  • 减少支持两种不同模式的维护成本。

动机

维护非分代 ZGC 减缓了新功能的开发。正如 JEP 439: 分代 ZGC 中所述:

对于大多数用例而言,分代 ZGC 应该是一个比非分代 ZGC 更好的解决方案。我们应该最终能够用前者替换后者,以减少长期的维护成本。

描述

通过废弃 ZGenerational 选项并移除非分代 ZGC 代码及其测试来移除非分代模式。该选项将在未来的版本中过期,在那时它将不会被 HotSpot JVM 识别,并且 JVM 将拒绝启动。

在进行这些更改之后,相关命令行选项的工作方式如下:

  • -XX:+UseZGC
    • 使用分代 ZGC。
  • -XX:+UseZGC -XX:+ZGenerational
    • 使用分代 ZGC。
    • 打印过时选项警告。
  • -XX:+UseZGC -XX:-ZGenerational
    • 使用分代 ZGC。
    • 打印过时选项警告。

切换到分代 ZGC 的工作负载可能会在日志输出和服务性及管理 API 提供的数据方面遇到差异。

风险和假设

此 JEP 与 JEP 439: 分代 ZGCJEP 474: ZGC 默认分代模式 共享其风险和假设。

分代 ZGC 的性能将不同于非分代 ZGC。这带来的主要风险是某些工作负载本质上是非分代的,因此可能会看到轻微的性能下降。我们认为这是一个足够小的工作负载集合,不足以证明长期维护两种独立的 ZGC 模式的成本是合理的。

具体风险包括:

  • 用户可能需要调整针对非分代 ZGC 优化的配置。
  • 过时选项警告消息可能会引起问题。
  • 与 JVM 内部、GC 日志以及通过管理接口可用的数据紧密耦合的工作负载可能需要额外的关注。

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.