Sun Microsystems Logo
First Previous Next Last Overview
 

LAB-1205: Java Application Performance Analysis

Exercise 13: Use the concurrent garbage collector

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.

Applications often have different requirements.  Perhaps overall throughput is most important.  Perhaps minimizing GC pause times is important.  That's why the JVM gives you a choice of different garbage collection algorithms.  In this exercise we will experiment with using the concurrent garbage collector as described in the Tuning Garbage Collection with the 5.0 Java™ Virtual Machine document.

Your application may simply perform better with the throughput collector or the low pause time collector.  The best way to find out is to test it!

Steps to follow

  1. For this exercise we use our best heap settings from Exercise 9, but set the concurrent garbage collector.
    compiler=-server
    heap=-XX:PermSize=12m -XX:MaxPermSize=12m -XX:NewSize=4m -XX:MaxNewSize=4m -Xms16m -Xmx16m
    gc=-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC
    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. Notice that the sawtooth pattern in the old gen is back -- like when the new gen was too small!  But we know the new gen is sized right???  Hey look at the survivor spaces -- they are NOT being used!  And notice in the survivor age histogram that the maximum tenuring threshold is zero!

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

  5. Because we are promoting any live objects during a minor GC to the old gen we are getting the sawtooth pattern in old gen.

Summary

The concurrent collector can reduce the GC pause times for your application.

How should survivor spaces be sized and how should you set the maximum tenuring threshold to take advantage of them?  That is the subject of the next exercise, Exercise 14.

Next Steps