Clarification of meaning new JVM memory parameters InitialRAMPercentage and MinRAMPercentage(澄清新的JVM内存参数InitialRAMPercentage和MinRAMPercentage的含义)
问题描述
参考:https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8186315
我真的很难找出 MinRAMPercentage 的作用,尤其是与 InitialRAMPercentage 相比.
I'm really struggling to find out what MinRAMPercentage does, especially compared to InitialRAMPercentage.
我假设 InitialRAMPercentage 设置启动时的堆数量,MinRAMPercentage 和 MaxRAMPercentage 设置允许 JVM 收缩/增长的堆的上下限.
I assumed that InitialRAMPercentage sets the amount of heap at startup, that MinRAMPercentage and MaxRAMPercentage set the bottom and top limit of heap that the JVM is allowed to shrink/grow to.
显然情况并非如此.当我像这样启动 JVM(使用 UseContainerSupport,具有这些新的内存设置参数)时:
Apparently that is not the case. When I start a JVM (with UseContainerSupport, having these new memory setting parameters) like so:
java -XX:+UseContainerSupport -XX:InitialRAMPercentage=40.0 -XX:MinRAMPercentage=20.0 -XX:MaxRAMPercentage=80.0 -XX:+PrintFlagsFinal -version | grep Heap
InitialHeap 和 MaxHeap 已设置,我找不到最小堆大小"值;因此,MinRAMPercentage 似乎从未被使用过.
InitialHeap and MaxHeap get set, there is no "Minimum Heap Size" value that I can find; Consequently, that MinRAMPercentage never seems to get used.
超级困惑,显然,我不是唯一一个;OpenJ9 伙计们似乎也没有完全解析这些选项的意图,因为我已经收集了 here 和 这里.他们似乎选择干脆不实施 MinRAMPercentage afaics.
Super confused, and apparently, I'm not the only one; the OpenJ9 dudes seem to also not fully parse the intent of these options, as I've gathered here and here. They seem to have opted to simply not implement MinRAMPercentage afaics.
那么:设置 MinRAMPercentage 的真正预期用途和效果是什么?
So: What is the real intended usage and effect of setting MinRAMPercentage?
推荐答案
-XX:InitialRAMPercentage
用于计算初始堆大小 当InitialHeapSize
/-Xms
未设置.
这听起来违反直觉,但是 -XX:MaxRAMPercentage
和 -XX:MinRAMPercentage
都用于计算 最大堆大小 MaxHeapSize
/-Xmx
未设置:
It sounds counterintuitive, but both -XX:MaxRAMPercentage
and -XX:MinRAMPercentage
are used to calculate maximum heap size when MaxHeapSize
/ -Xmx
is not set:
对于物理内存较小的系统,
MaxHeapSize
估计为
phys_mem * MinRAMPercentage / 100 (if this value is less than 96M)
否则(非小物理内存)MaxHeapSize
估计为
MAX(phys_mem * MaxRAMPercentage / 100, 96M)
确切的公式有点复杂,因为它还考虑了其他因素.
The exact formula is a bit more complicated as it also takes other factors into account.
注意:计算初始和最大堆大小的算法取决于特定的 JVM 版本.控制堆大小的首选方法是显式设置 Xmx
和 Xms
.
Note: the algorithm for calculating initial and maximum heap size depends on the particular JVM version. The preferred way to control the heap size is to set Xmx
and Xms
explicitly.
另请参阅这个问题.
这篇关于澄清新的JVM内存参数InitialRAMPercentage和MinRAMPercentage的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:澄清新的JVM内存参数InitialRAMPercentage和MinRAMPercentage的含义
基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 降序排序:Java Map 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01