Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseAdaptiveSizePolicy and other jvm opts

Tags:

java

jvm

The JVM option -XX:+UseAdaptiveSizePolicy is defined as part of the hotspot ergonomics and can be specified with throughput or the pause time priority.

However, my question is - is it right to have the other jvm options like NewSize and SurvivorRatio mentioned along with it?. What exactly is the impact of doing that?

like image 597
Anna Avatar asked Sep 03 '10 09:09

Anna


People also ask

What are JVM options?

There are three types of options that you can add to your JVM, standard, non-standard and advanced options. If you apply an advanced option, you always precede the option with -XX: . Similarly if you're using a non-standard option, you'll use -X . Standard options don't prepend anything to the option.

What are the JVM parameters?

Now let's discuss the most frequently used JVM Parameters which are 3 namely as follows: Java Heap Size. Garbage Collector. Print GC.


2 Answers

Just FYI, -XX:+UseAdaptiveSizePolicy is enabled by default in any recent version of the Sun JVM.

Also, I found an article:

Avoid trouble: -XX:SurvivorRatio= option is incompatible with the JVM parameter -XX:+UseAdaptiveSizePolicy. Please use either one according to your situation.

I couldn't find a definitive answer for NewSize, but it appears it sets the initial young generation size, not permanent, so it's not mutually exclusive with UseAdaptiveSizePolicy.

However, here's a bunch of articles:

  • http://download.oracle.com/javase/1.5.0/docs/guide/vm/gc-ergonomics.html
  • http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html
  • http://developers.sun.com/mobility/midp/articles/garbagecollection2/

In most cases, however, if you're tuning SurvivorRatio will want to tune NewSize and MaxNewSize.

like image 107
The Alchemist Avatar answered Nov 15 '22 18:11

The Alchemist


My experience with combinations of non-standard options (-X) is that they behave slightly different among JVM versions and platforms.

If you want to be really sure about which is the result of a set of options, check the real JVM values with jmap -heap if possible, e.g.

Client compiler detected.
JVM version is 1.5.0_14-b03

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
    MinHeapFreeRatio = 40
    MaxHeapFreeRatio = 70
    MaxHeapSize = 209715200 (200.0MB)
    NewSize = 2228224 (2.125MB)
    MaxNewSize = 4294901760 (4095.9375MB)
    OldSize = 1441792 (1.375MB)
    NewRatio = 8
    SurvivorRatio = 32
    PermSize = 8388608 (8.0MB)
    MaxPermSize = 134217728 (128.0MB)
[...]
like image 43
fglez Avatar answered Nov 15 '22 18:11

fglez