Sun Microsystems Logo
First Previous Next Last Overview
 

LAB-1205: Java Application Performance Analysis

Exercise 12: Use AggressiveHeap (but tune for maximum memory consumption)

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 want to get the benefits of AggressiveHeap that we learned about in Exercise 11, but want to override certain defaults -- especially the maximum memory usage.

Steps to follow

  1. For this exercise we use the two options from Exercise 11: -server -XX:+AggresiveHeap and our best heap tuning from Exercise 9 (perm gen 12 MB, max heap 16 MB and disable explicit GC's).
    compiler=-server
    heap=-XX:PermSize=12m -XX:MaxPermSize=12m -Xms16m -Xmx16m -XX:+AggressiveHeap
    gc=-XX:+DisableExplicitGC
    other=

  2. Click [Start]. You will see the Java 2D Demo application start.... 

  3. Notice there is no survivor age histogram (since we are using the parallel collector).  Note that the heap sizes seem much more reasonable.  Note also that the JVM will sometimes resize eden and the survivor spaces.

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

  5. We've eliminated the explicit GC's.

Summary

Should I always use AggressiveHeap for server workloads?  It's a good test to include in your test plan.  It's a hint to the JVM that your application will have a lot of 'server-like' properties.

Do I have to take AggressiveHeap as an "all or nothing" option?  No, you can set AggressiveHeap and override it as necessary (for maximum heap size and you can even change to a different garbage collector).

What if I want the parallel collector (but not necessarily everything with AggressiveHeap)?  You certainly can evaluate the impact of just changing the collector on its own.  The option to select the parallel collector is -XX:+UseParallelGC as described in the Tuning Garbage Collection with the 5.0 Java™ Virtual Machine document.

Next Steps