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

后端 未结 5 1393
佛祖请我去吃肉
佛祖请我去吃肉 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:01

    1. Application will suffer frequent GC with lower -Xms value.
    2. Every time asking for more memory from OS with consume time.
    3. Above all, if your application is performance critical then you would certainly want to avoid memory pages swapping out to/from disk as this will cause GC consuming more time. To avoid this, memory can be locked. But if Xms and Xmx are not same then memory allocated after initial allocation will not be locked.

提交回复
热议问题