我在Linux 64上的Tomcat 9.0.6上运行了一个Spring应用程序。因为它需要大量内存,所以我想尝试一下Hotspot:-Xmx128G的OpenJ9 JVM,在这方面它应该更高效(当前堆限制为Hotspot:Hotspot)。我安装了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在默认情况下启用的范围之上,但这失败了,因为我的操作系统已经分配了大部分<4 4GB的内存范围,但需要一些来使用compressedrefs。既然我不能保证不会出现这种情况,有没有办法在不使用压缩文件的情况下使用OpenJ9?这会带来内存消耗方面的好处吗?或者,有没有什么方法可以使用Xmx设置非常高的压缩文件?
我也尝试过设置这个选项,但是没有用:https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/openj9/xmcrs/index.html?view=embed
如何找到合适的大小? 1G和64m失败。即使我找到了正确的设置,这个值如何保证操作系统没有分配所有较低的内存地址?
发布于 2019-10-17 14:32:28
我找到了这个版本,它允许非压缩文件,从而解决了我的问题:https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=openj9#linuxxl
发布于 2019-10-18 05:57:52
使用压缩refs 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)
https://stackoverflow.com/questions/58425836
复制相似问题