Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Garbage First and New Ratio setting

3182359Jul 22 2020

Hi Java people,

We've been investigating about this and we're experiencing an issue in Java 1.8.0_192. We've got a Java application using components such as eclipse equinox/OSGI, Tomcat, third party libraries, etc. everything running on top of one Java process.

Older versions of this application have used Old Parallel GC along with -XX:NewRatio=2. Then we have switched to Garbage First and as per documentation, it is recommended to remove -XX:NewRatio as it affects performance. Information from here and here

Other flags for non-heap used are -XX:CompressedClassSpaceSize=256m, -XX:MetaspaceSize=256m and -XX:MaxMetaspaceSize=512m

During tests, it has been discovered that by removing the NewRatio flag allows the JVM to use a significant amount of extra RAM having the Java process using a higher amount of RAM allocated. This causes issues on a graviton deploy, particularly when doing an upgrade. This is a Linux machine.

Errors like:

error 20-Jul-2020 11:42:21 �[m�[0;31mERROR: On node frontend.solution-graviton-xxxxx: �[1;31m/Stage[main]/apache::Ajp_port/Exec[allow-httpd-on-XXXXX]: Could not evaluate: Cannot allocate memory - fork(2)�[0m

By keeping -XX:NewRatio=2, this doesn't happen and there's available RAM to work with Graviton, etc.

I've also done some tests with stand alone Java applications and the overall behaviour is that without -XX:NewRatio flag and using Garbage First, there is a difference in the RAM consumed, i.e. the Java process is bigger when no -XX:NewRatio is in place.

Question would be, is there any explanation for this? I've been trying to find information in MOS, here and documentation, but I couldn't find anything unfortunately.

Thanks in advance for the feedback!

Alexis

Comments
Post Details
Added on Jul 22 2020
0 comments
878 views