Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is setting xmx == xms is still good practice in java 11?

Is setting xmx == xms is still good practice in java-11 with G1 gc?

I ask this in the context of web applications.

like image 808
simo Avatar asked Jan 31 '20 06:01

simo


People also ask

Is it good to set the max and min JVM heap size the same?

Larger heap size will cause less frequent, but bigger and more disruptive garbage collection if using the traditional oracle garbage collection algorithm. So bigger is not better. The exact behavior will depend on the JVM implementation.

What is the recommended heap size in Java?

It is recommended to increase the Java heap space only up to one-half of the total RAM available on the server. Increasing the Java heap space beyond that value can cause performance problems. For example, if your server has 16 GB of RAM available, then the maximum heap space you should use is 8 GB.

What is Xms and XMX while starting JVM?

The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool. This means that your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory.


1 Answers

For G1 GC, it is recommended to explicitly set the maximum and minimum heap size to the same value to avoid dynamic shrinking and growing of the heap during the applications lifecycle.

https://backstage.forgerock.com/knowledge/kb/article/a75965340

like image 60
Luan Kevin Ferreira Avatar answered Oct 01 '22 23:10

Luan Kevin Ferreira