Java Reference
In-Depth Information
Table 6-2. Effect of dynamic GC tuning
GC settings
End heap size Percent time in GC OPS
Default
1.7 GB
9.3%
8.4
588 MB
15.1%
7.9
MaxGCPauseMillis=50ms
2 GB
5.1%
9.0
Xms=Xmx=2048m
Xmx=3560M ; MaxGCRatio=19 2.1 GB
8.8%
9.0
In a test that spends a significant amount of time in GC, things are different. The JVM will
never be able to satisfy the 1% throughput goal in this test; it tries its best to accommodate
the default goal and does a reasonable job, using 1.7 GB of space.
Things are worse when an unrealistic pause time goal is given. To achieve a 50 ms collection
time, the heap is kept to 588 MB, but that means that GC now becomes excessively frequent.
Consequently, the throughput has decreased significantly. In this scenario, the better per-
formance comes from instructing the JVM to utilize the entire heap by setting both the initial
and maximum sizes to 2 GB.
Finally, the last line of the table shows what happens when the heap is reasonably sized and
we set a realistic time ratio goal of 5%. The JVM itself determined that approximately 2 GB
was the optimal heap size, and it achieved the same throughput as the hand-tuned case.
QUICK SUMMARY
1. Dynamic heap tuning is a good first step for heap sizing. For a wide set of applic-
ations, that will be all that is needed, and the dynamic settings will minimize the
JVM's memory use.
2. It is possible to statically size the heap to get the maximum possible performance.
The sizes the JVM determines for a reasonable set of performance goals are a
good first start for that tuning.
Search WWH ::




Custom Search