gpt4 book ai didi

java - 在开始时管理 JVM OldGen 峰值

转载 作者:行者123 更新时间:2023-12-02 16:13:43 26 4
gpt4 key购买 nike

我们目前使用的 VMOptions 如下所示,用于我们使用 spring webflux 设计的微服务之一。我们目前为每个 pod 预留了 4 个 CPU 和 5 GB 内存。

-Xms4096m -Xmx4096m -Xss512k -XX:+UseG1GC -XX:+UseStringDeduplication -XX:ParallelGCThreads=8 -XX:ConcGCThreads=2 -XX:MaxGCPauseMillis=120 -XX:G1ReservePercent=10

JVM Graph

每次我重新部署我们的应用程序并引入一些固定的 QPS 负载时,我观察到 OldGen 上出现了 3 个大峰值,然后它成功地进入了某种稳定的和谐状态。我从一开始就期待稳定的和谐,但不确定一开始的行为。是否有人也遇到过这种情况或知道解决方法。

最佳答案

您观察 G1 Adaptive IHOP 的效果。

来自G1 tuning guide :

The Initiating Heap Occupancy Percent (IHOP) is the threshold at whichan Initial Mark collection is triggered and it is defined as apercentage of the old generation size.

G1 by default automatically determines an optimal IHOP by observinghow long marking takes and how much memory is typically allocated inthe old generation during marking cycles. This feature is calledAdaptive IHOP. If this feature is active, then the option-XX:InitiatingHeapOccupancyPercent determines the initial value as a percentage of the size of the current old generation as long as therearen't enough observations to make a good prediction of the InitiatingHeap Occupancy threshold. Turn off this behavior of G1 using theoption -XX:-G1UseAdaptiveIHOP. In this case, the value of-XX:InitiatingHeapOccupancyPercent always determines this threshold.

默认情况下,-XX:G1AdaptiveIHOPNumInitialSamples 等于 3。这意味着,G1 使用前 3 个完成的标记周期作为预测最优 IHOP 的输入。

这种行为没有错,不需要“修复”任何东西。但是,如果您知道特定应用程序的最佳 IHOP 值,并希望 GC 从一开始就使用它,请关闭 -XX:-G1UseAdaptiveIHOP,并设置 -XX:InitiatingHeapOccupancyPercent手动。

关于java - 在开始时管理 JVM OldGen 峰值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67296753/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com