0

I have a JVM which I start with the following parameters : -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled -Xmx2048m
In order to have more performance should I add Xms and XX:PermSize? What is a good value for Xms and XX: PermSize ( percentage of max or equal to max) ?
How can I check the performance ( start time etc. ) in linux.

Thank you very much

4
  • What do you mean by "more performance"? Commented Feb 13, 2015 at 14:24
  • If I put a min ,I would think, that it doesnt have to do always the memory check and allocated extra memory and take memory out when it doesnt need it. So since there are less checks it should be more performant since the memory is allocated ( at least a min ). Let me know if I am wrong Commented Feb 13, 2015 at 14:39
  • 1
    if you're not explicitly setting a min value of heap, there will be calculated min value for your heap based on the java version you're using and the machine you're running it on. So don't worry about that unless you see too many Full GCs for your application :) Commented Feb 13, 2015 at 15:01
  • 1
    speculating a value for these flags is really hard without actually monitoring your application. Stick to the defaults and attempt to tune it only if you know what you're doing, otherwise you actually might make it worse. In case you want to monitor/profile your application, i suggest you have a look at VisualVM Commented Feb 13, 2015 at 15:06

1 Answer 1

1

The Xms flag dates from a time before the JVM had incremental garbage collection, and so it was beneficial to keep the heap as small as it could be (to keep garbage collections as short as possible). So you would reserve an appropriate maximum amount of memory at startup with the Xmx flag, but only commit a smaller chunk with Xms.

Now we have generational, incremental garbage collectors, it is often optimal to set Xms and Xmx to the same value. This avoids the need to dynamically allocate more memory to the heap, which requires a full garbage collection that can affect performance negatively.

If you start your application with a low value for Xms and turn on GC logging (-verbose:gc -Xloggc:FILENAME) the log file will show how the heap and generation sizes change as the application runs and give you an idea of how much memory your app will actually need.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.