机会主义ZGC:利用空闲核心实现更有效的并发垃圾回收
Opportunistic ZGC: Leveraging Idle Cores for More Effective Concurrent Garbage Collection
浏览论文内容
中文总结 AI 辅助
针对ZGC默认保守调度导致堆使用浪费的问题,提出反馈驱动的OppZGC策略,动态利用空闲CPU核心进行并发回收,自动约束堆大小,在DaCapo基准上平均降低最大堆使用61%-90%,且对性能影响极小。
中文摘要 AI 辅助
托管语言运行时通常提供并发垃圾回收器,以便具有大工作集的延迟关键型应用程序能够在大部分回收工作在后台进行的同时继续运行。ZGC是OpenJDK中一个生产级、分代式、并发收集器,具有亚毫秒级的暂停时间。虽然ZGC被设计为并发运行,但使用ZGC进行频繁且过度的回收仍可能因同步成本和与共享计算资源的干扰而减慢变更器(mutators)的速度。因此,ZGC调度器默认是保守的,在大多数情况下,会在调度回收之前将堆增长到允许的最大值。虽然这种方法最小化了回收工作,但如果最大堆大小未根据实际工作集进行良好调整,则可能是浪费甚至有害的。我们提出了机会主义ZGC(OppZGC),一种反馈导向的ZGC调度策略,它动态且自动地约束堆,无需针对每个应用程序进行调整。OppZGC识别CPU核心利用不足的时期,并利用这些时期与ZGC进行并发回收。我们描述了OppZGC在OpenJDK的HotSpot Java虚拟机中的设计和实现,并使用来自DaCapo Chopin和SPECjbb的标准和延迟敏感基准对其进行了评估。当有足够的CPU容量进行额外回收时,OppZGC会限制堆使用,并避免在额外回收会大幅降低性能时调度它们。总体而言,与默认ZGC相比,它平均将我们DaCapo基准的最大堆使用量减少了61%至90%(取决于配置),而对吞吐量和请求延迟的影响最小。
英文摘要
Managed language runtimes often provide concurrent garbage collectors so that latency-critical applications with large working sets can keep running while most collection work proceeds in the background. ZGC is a production-quality, generational, concurrent collector in OpenJDK with sub-millisecond pause times. While ZGC is designed to run concurrently, frequent and excessive collections with ZGC can still slow the mutators due to synchronization costs and interference with shared computing resources. Hence, the ZGC scheduler is conservative by default, and in most cases, will grow the heap toward the maximum allowed before scheduling a collection. While this approach minimizes collection effort, it can be wasteful, or even harmful, if the maximum heap size is not well tuned to the actual working set. We propose Opportunistic ZGC (OppZGC), a feedback-directed ZGC scheduling policy that constrains the heap dynamically and automatically, without per-application tuning. OppZGC identifies periods when CPU cores are underutilized and leverages them for concurrent collection with ZGC. We describe the design and implementation of OppZGC in OpenJDK's HotSpot Java VM and evaluate it with standard and latency-sensitive benchmarks from DaCapo Chopin and SPECjbb. OppZGC limits heap usage when there is CPU capacity sufficient for additional collections, and avoids scheduling extra collections when they would substantially degrade performance. Overall, it reduces maximum heap usage for our DaCapo benchmarks by between 61% and 90%, on average, depending on configuration, with minimal impact on throughput and request latency compared to default ZGC.
发表机构
- Oak Ridge National Laboratory(橡树岭国家实验室)
机构由 AI 辅助整理,请以论文原文为准。