Sun Microsystems Logo
First Previous Next Last Overview
 

LAB-1205: Java Application Performance Analysis

Exercise 5: Old generation too small (it really is too small!)

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 Exercise 4 we examined how having a poor NewRatio between young gen and the overall heap size can cause performance degradation.  In this exercise we will determine when we simply do not have enough space.

Steps to follow

  1. For this exercise we set the maximum heap size to a very tiny 4 MB.  We're not going to bother with setting the young gen size or NewRatio (the JVM will have its hands full as it is!).
    compiler=
    heap=-Xmx4m
    gc=
    other=


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

  3. You will see the Java 2D Demo application try to start... It will probably get stuck before it gets going all the way.

  4. You will see that (if the Java 2D Demo application doesn't crash) Visual GC shows the application is alive, but nothing is happening.  All the Graphs are flatlined -- it is stuck!

  5. To stop the stuck Java 2D demo click on [Stop]

  6. You will probably see an out of memory error in the log file like this:
    [Exercise05-Java2DemoLog]

Summary

How do you know old gen is really too small?  You application may not start, it may hang, or it may crash.  You will almost certainly see out of memory errors in the log file.  You probably will notice that most of the CPU utilization is very high, spending nearly all of its time in GC.

Why is a heap that is too small a problem?  Obviously if the application cannot start or run at all you have a big problem.

Next Steps