15

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

I ask this in the context of web applications.

Vishwa Ratna
  • 5,567
  • 5
  • 33
  • 55
simo
  • 301
  • 1
  • 4
  • 9
  • 1
    Does this answer your question? [Is there any advantage in setting Xms and Xmx to the same value?](https://stackoverflow.com/questions/43651167/is-there-any-advantage-in-setting-xms-and-xmx-to-the-same-value) – Eugene Jan 31 '20 at 21:10
  • 2
    @Eugene The OP's question is very specific: it is asking about web applications using G1 garbage collection on Java 11. The linked question was asked about a year and a half before JDK 11 was even released, so while it may be of interest it can't possibly address the OP's question. – skomisa Feb 01 '20 at 23:36
  • @skomisa How is this "specific" and not broad? Any answer is going to be vague and taking guesses. – Eugene Feb 02 '20 at 02:11
  • 2
    @Eugene This question is about setting Xmx and Xms on Java 11 for web applications using GC1 garbage collection. That seems very, very specific to me. And the question you linked to was asked long before Java 11 was released, so while it may contain some useful information, this question inherently cannot be a duplicate of that one. – skomisa Feb 02 '20 at 07:29
  • @skomisa thats ok, we dont have to agree on this one. _To me_, specific means a different thing, but anyway, I see your point. It does not mean I agree with it I just "see it". – Eugene Feb 02 '20 at 08:25
  • Does this answer your question? [Is it good to set the max and min JVM heap size the same?](https://stackoverflow.com/questions/6862972/is-it-good-to-set-the-max-and-min-jvm-heap-size-the-same) – user5994461 Mar 17 '23 at 20:03

1 Answers1

2

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

Luan Kevin Ferreira
  • 1,184
  • 2
  • 16
  • 40