java - OpenJ9 tomcat 不会以高 -Xmx 堆选项启动

标签 java jvm heap-memory openj9

我有一个 Spring 应用程序在 Linux 64 上的 Tomcat 9.0.6 中运行。因为它需要大量内存,所以我想尝试 OpenJ9 JVM,据称它在这方面效率更高(Hotspot 的当前堆限制: -Xmx128G)。 我安装了 64 位的 adoptopenjdk-8-jdk-openj9:

/usr/lib/jvm/adoptopenjdk-8-jdk-openj9/bin/java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
Eclipse OpenJ9 VM (build openj9-0.14.2, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20190521_315 (JIT enabled, AOT enable
OpenJ9   - 4b1df46fe
OMR      - b56045d2
JCL      - a8c217d402 based on jdk8u212-b04)

启动tomcat导致如下错误:

This JVM package only includes the '-Xcompressedrefs' configuration. Please run the VM without specifying the '-Xnocompressedrefs' option or by specifying the '-Xcompressedrefs' option.

设置此选项后,出现以下错误:

JVMJ9GC028E Option too large: '-Xmx'
JVMJ9VM015W Initialization error for library j9gc29(2): Failed to initialize
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

文档不是很清楚,但我发现了这个: https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/mm_gc_compressed_refs.html

Compressed references are used by default on a 64-bit IBM SDK when the value of -Xmx, which sets the maximum Java heap size, is in the correct range. Start of changes for service refresh 2 fix pack 10On AIX®, Linux and Windows systems, the default range is 0 - 57 GB. For larger heap sizes, you can try to use compressed references by explicitly setting -Xcompressedrefs.End of changes for service refresh 2 fix pack 10 However, larger heap sizes might result in an out of memory condition at run time because the VM requires some memory at low addresses. You might be able to resolve an out of memory condition in low addresses by using the -Xmcrs option.

所以基本上,至少这个 JDK 版本只支持压缩引用,为了使用它,我必须手动设置它,因为我的 Xmx 超出了默认启用它的范围,但是失败了,因为我的操作系统已经分配给 <4GB 内存范围的大部分,但需要一些才能使用 compressedrefs。由于我永远无法保证不会出现这种情况,有什么方法可以在没有压缩引用的情况下使用 OpenJ9?这甚至会在内存消耗方面产生好处吗?或者有什么方法可以使用具有非常高 Xmx 设置的压缩引用?

我也试过设置这个选项,但没有用:https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/openj9/xmcrs/index.html?view=embed

如何找到合适的尺寸? 1G 和 64m 失败。即使我找到了正确的设置,这个值如何保证操作系统还没有分配所有较低的内存地址?

最佳答案

使用压缩引用 JVM 的限制是 57G,如果指定了 -Xnocompressedrefs 选项,则无法运行它。

此处记录了 57G 分区:https://www.eclipse.org/openj9/docs/xcompressedrefs/

发行说明中提到了-Xnocompressedrefs 问题:https://github.com/eclipse/openj9/blob/master/doc/release-notes/0.15/0.15.md

引用:https://github.com/eclipse/openj9/issues/479

创建支持两者的单个 JVM 包含在:https://github.com/eclipse/openj9/issues/643

https://github.com/eclipse/openj9/pull/7505

(感谢 Eclipse OpenJ9 slack 社区的帮助,特别是 Peter Shipton)

关于java - OpenJ9 tomcat 不会以高 -Xmx 堆选项启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58425836/

相关文章:

java - 在 java spring boot 中,图像没有从 excel 插入数据库?

java - 如何在 SeparatedListAdapter 中设置文本颜色?

java - 相同的正则表达式搜索结果在 C++ 和 Java 中不同

java - 如何通过已知的PID/TID获取JVM线程名/id

java - 同一程序在两个不同的 JVM 中

java.lang.OutOfMemoryError : Java heap space with 300MB java. exe 上限

java - 如何动态监控 Java 堆大小?

java - 在 JAX-RS 中初始化实体管理器以实现规模化

C: 动态字符数组崩溃堆

Java 堆大小 - 没有 AdaptiveSizePolicy 的年轻代大小