|
|
Learning goals of this exercise
In this exercise you will learn:
Background for this exercise
Please see Exercise 1 for an overview of running
the javaperf GUI launcher.
To make best use of the
various areas of the heap sometimes it may be necessary to tune the
survivor ratio (the size of the survivor spaces) and the maximum
tenuring threshold (how long objects must live before getting promoted
to the old gen). There is a good discussion of this topic in the
Tuning
Garbage Collection with the 5.0 Java™ Virtual Machine
document
In Exercise 13 we found
that the survivor spaces turned out to be only 64 K??? To make
the size more reasonable we will use the option -XX:SurvivorRatio=6.
This means the size of each survivor space is the YoungGen /
(SurvivorRatio + 2) = 512 KB (when YoungGen is set to 4 MB).
That's a much more reasonable size....
However if there is no tenuring it doesn't matter! We found that
in Exercise 13 the tenuring threshold was set to zero. After
examining prior exercises it seems that most objects get promoted to
the old gen by about the second or third minor GC. So let's set -XX:MaxTenuringThreshold=4 so that any objects that get to the forth minor GC might as well get promoted (but at least we will use the survivor spaces!).
Steps to follow
compiler=-server
|
. You will see the Java 2D Demo application start.... Immediately click on the "Transforms" tab.
Then click into the "Shear" area so it fills the entire window.![[Stop]](Stop.png)
Summary
By looking at the behavior
in the application we were able to tune the survivor spaces and
tenuring threshold to eliminate prematurely promoting objects to the
old generation.
Of course every application
has different object allocation behavior and lifetimes.... Fine
tuning heap sizing for performance often involves sizing the survivor
spaces (larger or smaller) as well as the tenuring threshold (how much
the survivor spaces are used, if at all). For more on these
topics please check out the
Young Generation Guarantee section of the Tuning
Garbage Collection with the 5.0 Java™ Virtual Machine
document.
Next Steps
This lab documentation is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.