Sun Microsystems 820434310 Server User Manual


 
memory structures. The dierence between the maximum address space and the total of those
values is the amount of memory that can be allocated to the heap.
You can improve performance by increasing your heap size or using a dierent garbage
collector. In general, for long-running server applications, use the J2SE throughput collector on
machines with multiple processors (-XX:+AggressiveHeap) and as large a heap as you can t in
the free memory of your machine.
Heap Tuning Parameters
You can control the heap size with the following JVM parameters:
-Xmsvalue
-Xmxvalue
-XX:MinHeapFreeRatio=minimum
-XX:MaxHeapFreeRatio=maximum
-XX:NewRatio=ratio
-XX:NewSize=size
-XX:MaxNewSize=size
-XX:+AggressiveHeap
The -Xms and -Xmx parameters dene the minimum and maximum heap sizes, respectively.
Since GC occurs when the generations ll up, throughput is inversely proportional to the
amount of the memory available. By default, the JVM grows or shrinks the heap at each GC to
try to keep the proportion of free space to the living objects at each collection within a specic
range. This range is set as a percentage by the parameters -XX:MinHeapFreeRatio=minimum
and -XX:MaxHeapFreeRatio=maximum; and the total size bounded by -Xms and -Xmx.
Set the values of -Xms and -Xmx equal to each other for a xed heap size. When the heap grows
or shrinks, the JVM must recalculate the old and new generation sizes to maintain a predened
NewRatio.
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. 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.
By default, the Enterprise Server is invoked with the Java HotSpot Server JVM. The default
NewRatio for the Server JVM is 2: the old generation occupies 2/3 of the heap while the new
generation occupies 1/3. The larger new generation can accommodate many more short-lived
objects, decreasing the need for slow major collections. The old generation is still suciently
large enough to hold many long-lived objects.
To size the Java heap:
ManagingMemoryandGarbage Collection
SunGlassFishEnterpriseServer2.1PerformanceTuningGuide January200988