Speed tradeoff of Java's -Xms and -Xmx options

后端 未结 8 1810
北荒
北荒 2020-12-04 08:24

Given these two commands

A:

$ java -Xms10G -Xmx10G myjavacode input.txt

B:

$ java -Xms5G -Xmx5G myjavacode input.tx         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 09:19

    The speed tradeoffs between various settings of -Xms and -Xmx depend on the application and system that you run your Java application on. It also depends on your JVM and other garbage collection parameters you use.

    This question is 11 years old, and since then the effects of the JVM parameters on performance have become even harder to predict in advance. So you can try different values and see the effects on performance, or use a free tool like Optimizer Studio that will find the optimal JVM parameter values automatically.

提交回复
热议问题