From oracle gc tuning article 1 and article 2 :
Survivor Space Sizing
You can use the parameter SurvivorRatio
can be used to tune the size of the survivor spaces, but this is often not important for performance. For example, -XX:SurvivorRatio=6
sets the ratio between eden and a survivor space to 1:6.
In other words, each survivor space will be one-sixth the size of eden, and thus one-eighth the size of the young generation (not one-seventh, because there are two survivor spaces)
.
If survivor spaces are too small, copying collection overflows directly into the tenured generation. If survivor spaces are too large, they will be uselessly empty.
The NewSize
and MaxNewSize
parameters control the new generation’s minimum and maximum size. Regulate the new generation size by setting these parameters equal. The bigger the younger generation, the less often minor collections occur
.
NewRatio:
The size of the young generation relative to the old generation is controlled by NewRatio. For example, setting -XX:NewRatio=3
means that the ratio between the old and young generation is 1:3
, the combined size of eden and the survivor spaces will be fourth of the heap
.
As correctly quoted by Peter Lawrey
, setting survivor depends on type of your application. From gc tuning article by Oracle, here are the guidelines.
First decide the maximum heap size you can afford to give the virtual machine
. Then plot your performance metric against young generation sizes to find the best setting
If the total heap size is fixed, then increasing the young generation size requires reducing the tenured generation size
. Keep the tenured generation large enough to hold all the live data used by the application at any given time, plus some amount of slack space (10 to 20% or more).
Subject to the previously stated constraint on the tenured generation: Grant plenty of memory to the young generation and increase the young generation size as you increase the number of processors, because allocation can be parallelized
. The default is calculated from NewRatio
and the -Xmx
setting