gpt4 book ai didi

java - LargePageHeapSizeThreshold 会激活JVM 中的UseTransparentHugePage 吗?

转载 作者:太空宇宙 更新时间:2023-11-04 09:58:39 25 4
gpt4 key购买 nike

最近我注意到在Linux发行版中我们有大页面内存可以设置为总是让系统一直使用大页面,ma​​dvise到让应用程序确定它们是否要使用大页面,或者从不

此功能有时会降低应用程序性能。

在 JVM 中,我们有两个可以激活的参数来控制此操作系统功能。

LargePageHeapSizeThreshold:如果该值小于MaxHeapSize,JVM 使用大页面大小。

UseTransparentHugePages:它是一个 boolean 值,可以是 true 或 false。

我的问题是,即使 UseTransparentHugePages=false?

即使 UseTransparentHugePages=false,在 Linux 中将大页面大小设置为always 是否会激活 JVM 以使用大页面?

最佳答案

is setting the LargePageHeapSizeThreshold to a value less than MaxHeapSize activates the huge page even if the UseTransparentHugePages=false?

不,它有效 the other way round : 如果最大堆大小小于 LargePageHeapSizeThreshold,则默认禁用大页面。

然而,这仅适用于“客户端”虚拟机,它没有 C2 或 Graal 编译器(如今是一种非常奇特的情况)。因此,在最流行的 JVM 版本中,标志 LargePageHeapSizeThreshold 根本没有影响。

Does setting huge page size to always in linux activates the JVM to use large page even if UseTransparentHugePages=false?

我假设您指的是以下设置:

echo always >/sys/kernel/mm/transparent_hugepage/enabled

在这种模式下,Linux 尝试在应用程序甚至不知道大页面的情况下为匿名内存映射(包括 Java 堆和代码缓存)分配大页面。所以,是的——JVM 可能会从这个选项中受益,即使它本身并不关心大页面。

另一方面,并​​不能保证Java Heap在这种模式下会一直使用大页面。如果 Linux 无法为内存区域分配大页面(例如,由于碎片),它将默默地回退到使用普通页面。

关于java - LargePageHeapSizeThreshold 会激活JVM 中的UseTransparentHugePage 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58147221/

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