java - OpenJ9 tomcat 不会以高 -Xmx 堆选项启动
问题描述
我有一个 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的这个版本只支持compressedrefs,为了使用它,我必须手动设置它,因为我的Xmx高于默认启用的范围,但这失败了,因为我的操作系统已经分配了很多<4GB 内存范围,但需要一些才能使用压缩引用。由于我永远无法保证不会出现这种情况,有没有什么办法可以在没有压缩引用的情况下使用 OpenJ9?这甚至会在内存消耗方面产生好处吗?或者有什么方法可以使用具有非常高 Xmx 设置的压缩引用?
我也尝试设置此选项,但没有帮助:https ://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/openj9/xmcrs/index.html?view=embed
我如何找到它的正确尺寸?1G 和 64m 失败。即使我找到正确的设置,该值如何保证操作系统尚未分配所有较低的内存地址?
解决方案
-Xnocompressedrefs
使用压缩的 refs JVM 的限制是 57G,如果指定了选项,您将无法运行它。
此处记录了 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)
推荐阅读
- boost - CLion 找不到 Boost 标头
- javascript - 长轮询挂起所有其他服务器请求
- linux - 从主题中的命令行发送带有 bash 参数的邮件
- python - 将 python 列表转换为带括号的 php 数组
- c# - 在 NUnit 和 Moq 中围绕 DateTime 窗口进行单元测试
- java - 如何避免 N Rooks 问题中 n = 8 的 stackoverflow 错误
- php - 如何写入mysql数据库?
- python - 没有名为 QtMultimedia 的模块
- php - 在循环中向数组添加值
- python - 以其他列的名称作为值的 Pandas DataFrame 聚合列