Is there any advantage in setting Xms and Xmx to the same value?

后端 未结 5 1396
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-08 21:48

Usually I set -Xms512m and -Xmx1g so that when JVM starts it allocates 512MB and gradually increases heap to 1GB as necessary. But I see these values s

5条回答
  •  长情又很酷
    2021-02-08 22:22

    Well there are couple of things.

    1. Program will start with -Xms value and if the value is lesser it will eventually force GC to occur more frequently
    2. Once the program reaches -Xms heap, jvm request OS for additional memory and eventually grabs -Xmx that requires additional time leading to performance issue, you might as well set it to that at the beginning avoiding jvm to request additional memory.

    It is very nicely answered here - https://developer.jboss.org/thread/149559?_sscc=t

提交回复
热议问题