UseParallelOldGC and survivor spaces
Hi!
At http://forum.java.sun.com/thread.jspa?threadID=673271&tstart=285 is dicussed how to fix survivor ratio to 1 while using ParallelGC. However, when trying to fix survivor ratio to 3 using PrarallelOldGC, I've got the following problem:
JVM options:
-Xms1536m -Xmx1536m -XX:NewSize=704M -XX:MaxNewSize=704M -XX:+UseParallelOldGC -XX:InitialSurvivorRatio=3 -XX:MinSurvivorRatio=3 -XX:-UseAdaptiveSizePolicy -XX:-UsePSAdaptiveSurvivorSizePolicy -d64 -Xss2m -Xbatch -XX:TargetSurvivorRatio=90 -XX:+DisableExplicitGC -verbose:gc -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCTimeStamps
GC output:
{Heap before gc invocations=3:
PSYoungGentotal 480640K, used 281638K
eden space240384K, 100% used
from space240256K, 17% used
tospace240256K, 0% used
ParOldGentotal 851968K, used 0K
object space 851968K, 0% used
PSPermGentotal 36032K, used 35878K
object space 36032K, 99% used
As you can see, the actual survivor ratio is still close to 1, causing too frequest young GC and a lot of space in survivor spaces to be wasted.
Any idea how to get around this?
Parallel scavenge with or without parallel compaction (aka parallel old)
silently enforces a minimum value of 3 for InitialSurvivorRatio and
MinSurvivorRatio. During initialization, if the VM detects the values are < 3,
they are increased to 3. This wasn't mentioned in the post that you cited.
So ...
-XX:InitialSurvivorRatio=1 -XX:MInSurvivorRatio=1
is equivalent to
-XX:InitialSurvivorRatio=3 -XX:MInSurvivorRatio=3
If you want smaller survivor spaces, use a larger value. Say you want each survivor to
be one-fifth the size of the young gen, then use
-XX:InitialSurvivorRatio=5 -XX:MInSurvivorRatio=5
Note that InitialSurvivorRatio and MinSurvivorRatio only apply when parallel
scavenge or parallel compaction (aka parallel old) are enabled.
The other collectors (e.g., CMS and Serial GC) use the option SurvivorRatio.
To add to the confusion, the SurvivorRatio option has a minimum value of 1, but
is 'biased' by 2 (i.e., the VM takes any value specified on the command line and
adds 2 to it).
In an attempt to alleviate some of the confusion, starting in JDK 6 you
can use SurvivorRatio with parallel scavenge and parallel old; earlier releases
silently ignore SurvivorRatio when parallel scavenge and/or parallel old are used.
If you do use it, remember that the VM will add 2 to any value you specify.
FWIW, this was done under bug id 6362902; however the public bug database entry
at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6362902 doesn't provide
any real information.
jxca at 2007-7-15 2:41:17 >
