|
|
Published October 2003
A breakthrough solution for isolating and resolving performance hazards, Borland® Optimizeit™ Enterprise Suite 5.5 ties together application-wide J2EE™ metrics with deep code-level granularity. The first solution of its kind, Borland Optimizeit Enterprise Suite combines award-winning Borland® Optimizeit™ Suite - memory and CPU profiling, thread and coverage analysis -with an advanced, higher-level J2EE dashboard. System-level JDBC, ® JMS, JNDI, JSP™ and EJB™ performance is immediately prioritized and linked directly to drill-down, root-cause diagnostics. Optimizeit Enterprise Suite equips developers with a comprehensive toolkit for regularly optimizing code and managing application quality.
This article provides an overview of Optimizeit Enterprise Suite, showing how the advanced capabilities can be used to solve two real-world Java application efficiency problems.
Optimizeit Enterprise Suite contains four tools to help you pinpoint and resolve code-level performance issues in any Java code:
To start profiling your Java application with Optimizeit Enterprise Suite, you’ll need to follow a few easy steps to attach Optimizeit profiler to your application. When you start any of the Optimizeit tools that comprise Optimizeit Enterprise Suite, the Edit Setting dialog window will appear requiring you to configure the settings.
The Settings dialog window contains these tabs:
Startup: This tab contains the required elements for your configuration, such as the program type, location, Class path and Source path. Defining the source path information helps correlate the performance data directly to the source to the offending line of source code.
Filters: If there are specific packages or classes you wish to test or ignore, use the Filters tab.
Virtual Machines: By default, Optimizeit tests with a Java 2 runtime. If you want to specify a virtual machine other than the default, use the Virtual Machines tab.
Once you have configured the settings, you can save them in a file ready to re-use whenever you profile the application again.
Optimizeit Enterprise Suite provides easy-to use integration wizards to integrating will popular applications servers and IDEs. For detailed information integration information please visit http://info.borland.com/techpubs/optimizeit/
For the purpose of this report, we’ll show you how to swiftly isolate memory leaks using Optimizeit Enterprise Suite’s Automatic Memory Leak Detector.
We start our profiling session by configuring the Edit Settings panel, and simply clicking “Attach Now”. Optimizeit Profiler immediately begins collecting real-time information from the application.
We’ll test the “Customers” functionality of our application to verify that it’s performing as expected.
To start checking for potential memory leaks we’ll need to first take a look at the heap view. We’ll also need to select the option to “Disable garbage collector” as we need to find the memory leak despite the garbage collector running. Another useful option to select at this stage is the object size display – this is done easily using the options in the Inspector.
We now enforce the Garbage Collector and then take a look at the instance counts. As we can see that keynote.util.CachedObject is allocated 484 times even after the Garbage Collector has run. This value clearly stands out as being high, so let’s see if this is a memory leak.
We’ll do this using the Automatic Memory Leak Detector [AMLD] – by pressing the AMLD button this captures the heap activity at a given time. By creating multiple heap activity states, AMLD automatically compares them to track down memory leaks.
As you can see we just captured heap state #1 with a heap-used value of 19Mb from the total heap size of 127Mb.
The next step is to repeat the steps performed in the test application a few more times and monitor the impact. So let’s run our test case few times- say 4 times - and then check on the heap state in the AMLD view.
The results of the test show that the heap used is same in Heap state#1 and Heap state#2. However, we can see that object “Object[] 0x6067800” was allocated 14834 times between the heap states. Let’s investigate this further by double-clicking it to access a graph view.
This shows the call graph and provides more detail regarding the object under investigation, revealing how was instantiated. Note that AMLD shows the potential memory leaks in red, so let’s drill-down to the source of where this is coming from. We can open the reference graph by right clicking on the red object. This takes us to a reduced reference graph, displaying the sequence of allocation for the selected object.
In the bottom pane you can see the sequence of Jakarta Tomcat - > jsp_service, then allocated at doStartTag, then all the way to keynote.util.Cachedmanager.putCache().
Let’s open the source to confirm that this is a memory leak and isolate the exact root cause.
This reveals that in putCache method, cacheHashMap.put() a method is called to put the object into the cache. It seems that the object is constantly being put into the cache and not being removed, essentially leaking the cache. This confirms that we have indeed tracked down a memory leak, that may not appear to be critical at this stage, but that over time could crash the JVM upon which runs your entire business application.
In just a few easy steps we have demonstrated how Optimizeit Enterprise Suite can save you a lot of time and frustration spent trying to track down and solve performance hazards such as memory leaks. Optimizeit Enterprise Suite also helps with solving excessive temporary object allocations, CPU bottlenecks, thread issues as well as advanced J2EE profiling capabilities to address component-level bottlenecks.
The extensive capabilities of Optimizeit Enterprise Suite are designed to be available at your fingertips to help you solve a multitude of performance issues as you develop your code. Eliminating performance glitches as you go proves to be a much more efficient and less arduous process in the long run, so try Optimizeit Enterprise Suite today!
For more information and a free 10-day trial please go to: http://www.borland.com/optimizeit/index.html