Sun Microsystems Logo
First Previous Next Last Overview
 

LAB-1205: Java Application Performance Analysis

Exercise 3: Young generation sized just right

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.

In this exercise we compromise by setting the young gen size between the "too small" value of Exercise 1 and the "too big" value of Exercise 2.
The "right" value will, of course, depend on the application.  As long as you avoid the extremes there is probably a range of acceptable values.  You will want client applications to tend towards the lower end of this range and server applications towards the higher end.

Steps to follow

  1. For this exercise we keep the maximum heap size the same at 16 MB.  However we set the young gen to 4 MB.
    compiler=
    heap=-XX:NewSize=4m -XX:MaxNewSize=4m -Xms16m -Xmx16m
    gc=
    other=

  2. Click [Start]. 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.

  3. The GC pattern may be similar to Exercise 2.

  4. When you see that the application runtime goes just over one minute click [Stop]

  5. So for this example run we have had 23 minor GC's (which is more than the 17 Exercise 2), but even so we have spent less total time -- only 2% -- in GC as compared to the extremes of young gen too small (3.45%) or too big (2.45%).

Summary

How do you know the young gen sized just right?  When it's not too small or too big! ;-)
Of course, spending a minimum amount of time in GC is a good indication.


Next Steps