Java Performance Tuning
Come here for all your Java Performance Training needs
Java(TM) is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries.
JavaPerformanceTuning.com is not connected to Sun Microsystems, Inc. and is not sponsored by Sun Microsystems, Inc.

|home |services |training |newsletter |tuning tips |tool reports |articles |resources |about us |site map |contact us |

Our valued sponsors who help make this site possible
Enerjy Software: Introducing Java development tools you'll actually use. 

Wily Technology- Manage performance of applications, portals, and integration 

Tool Report: Enerjy Performance Profiler

Java development tools
Develop clean, reliable Java code and create rules to address your coding issues.

*FREE* Java Profiling & Testing Tools
Free Java suite for profiling, code analysis and unit/functional/load testing

Java Performance Training
Don't leave performance to chance. Train your developers on site to build efficient Java programs


NEW LOCATIONS FOR Java Performance Training
Melbourne & Sydney, Feb/Mar 2005


Java Performance Training Courses
COURSES AVAILABLE NOW. We can provide training courses to handle all your Java performance needs

See Your Message Here
You could have your tool advertised here, to be seen by thousands of potential customers

Java Performance Tuning, 2nd ed
Covers Java SDK 1.4 and includes four new J2EE tuning chapters

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!
Enter email:

Cognotive
Advice, training and mentoring on the use of TopLink and J2EE

www.jsig.com
We support the London JSIG

www.java.net
We are a java.net member


Enerjy Software
Introducing Java development tools you'll actually use

Wily Technology
Manage performance of applications, portals, and integration


Java development tools
Develop clean, reliable Java code and create rules to address your coding issues.

*FREE* Java Profiling & Testing Tools
Free Java suite for profiling, code analysis and unit/functional/load testing

Java Performance Training
Don't leave performance to chance. Train your developers on site to build efficient Java programs


Published March 2005

The JavaPerformanceTuning.com Tool Reports are designed to help readers make informed choices about the tools they may wish to use. JavaPerformanceTuning.com provides these reports as a service to our readers; JavaPerformanceTuning.com is not responsible for the information provided by the tool author or vendor, nor do we necessarily endorse the products mentioned. JavaPerformanceTuning.com is not responsible for any additional resources provided from the article (such as downloadable files or other accessible material), even where we host such material.

Your team has spent the last few months designing and coding the next best Java application. Your customer has been satisfied with the updates throughout the project and Load Testing has proved the application is robust. However, one of the requirements is a performance-based target that requires the information to be returned to the user at a rate that is currently unobtainable by your application.

Performance issues found in testing can arise in numerous ways; lack of network bandwidth, hardware limitations, memory issues and poor design are just a few of the examples encountered in development and testing. The way an application has been written may also be an issue, and before the other areas on the list are examined, examining your code at run-time will give you confidence that your code is not a factor. Inexperienced developers may not be coding to optimal performance and although many bottlenecks and code quality issues are rectified at Code Review stages in the project lifecycle, some bottlenecks may slip through the net if the code review is a manual process and the application is large.

Introducing Enerjy Performance Profiler

Performance benchmarks and application profiling are usually left until the end of a project when functionality and the aesthetic look and feel have been completed. Urgent demands of deadlines and last minute changes by the customer can lead to profiling and tuning being frequently pushed aside. With the integration of Enerjy Performance Profiler into your development environment, performance profiling is no longer a gruelling process of configuration and presumption. Instead, you are provided with a simple, flexible tool that not only seems like a natural extension to your IDE but keeps you one step ahead of potential problems. This allows the project manager to be aware of any possible time increase, budget for it, and the customer can be updated as soon as possible.

Enerjy Performance Profiler uses a native interface to the JVM (the JVMPI) to get profiling information from a running Java application. This information is returned to the user in a clean, streamlined table format that can be easily examined to find performance bottlenecks in your code. Enerjy Performance Profiler monitors your program as it runs and collects detailed timing information about how much time is spent in selected methods. This enables you to focus your optimization efforts directly on the areas of code that have the most impact.

From the beginning the mindset of the Enerjy engineers was to provide developers with easy to use tools that help you improve your code without being intrusive. The configuration of Enerjy Performance Profiler is an excellent example of this. As long as an application has been compiled within your IDE (or running on a server) it will be available to be profiled. As Enerjy Performance Profiler runs within your IDE there are no external configuration files or separate profiling projects to set up. To run Enerjy Performance Profiler from within your IDE just select Run, Profile Configuration, Performance and the application you wish to profile (Figure 1).

Enerjy profiler menu options integrated in IDE
Figure 1: Running Enerjy Performance Profiler from your IDE

After you have decided where to focus the profiler within your application, the Enerjy Performance Profiler window will appear and you will be able to select a method or group of methods from your application. Either select a main() or run() method to profile the whole application or, if the application is large or you want to focus on a particular area, select the methods that interest you. The methods in your application are displayed in an easy to read tree structure (Figure 2).

filtering methods
Figure 2: Selecting methods to profile and package filters.

After choosing a method you will be able to include or exclude other packages in the profile data collection. Enerjy Performance Profiler can generate data about methods over which you have little control. Here you can instruct the profiler to ignore these packages and to focus primarily on your own code. Every package in your path will be available to either include or exclude from your results. You will almost always want to include the package of the code you are profiling, but excluding some of the java.* or javax.* packages can make your results much clearer to analyze. And that's it! Click OK and start your application allowing the Profiler to collect the data behind the scenes and use the 'Snapshot Button' to generate dynamic snapshots of data throughout the life of the application.

Unique Features

When using profiling tools, overhead is always a concern as using any tool with your code at run-time will always consume some resources. Enerjy Performance Profiler uses a unique adaptable profiling technique known as 'On-The-Fly Profiling'.

Notice the checkbox "Begin collecting data on application start" on the configuration window (Figure 3). By switching this off, Enerjy Performance Profiler is started and attached to the JVM, but does not begin profiling anything and therefore does not consume resources. If you are profiling J2EE applications, where is the benefit in profiling the Application Server start up process? (Unless you are building an Application Server!) Test results also show that starting the Application Server with a profiling tool running can result in the start up process taking between three and ten times longer.

Begin collecting data on application start box
Figure 3: The 'Begin collecting data on application start' box

Once the application has started and you have got to a point where you may be concerned about performance (or just interested in the results) hit the wrench icon (the Enerjy engineers like to call it the 'Lobster Claw'!) and specify the methods you wish to profile. This ensures the minimal overhead involved is only active on the parts of the application you are concerned about.

Lobster claw button
Figure 4: The 'Lobster Claw' Button.

Using this 'On-The-Fly' procedure you can actively refocus the profiler as you run through the application, dynamically taking snapshots and refocusing as and when necessary. In the past this was a time-consuming process as every time you needed to refocus a profiling tool on a different part of an application you would have to stop the application, stop the application server (if J2EE based), stop the profiler, reconfigure the profiler, restart the application server and restart the application ? Phew! Imagine profiling five or six different areas in one application?Enerjy Performance Profiler eliminates this laborious process.

Analyzing the Results

As the Enerjy Performance Profiler runs, the 'Status View' appears displaying a graph of the current memory usage and the state of each system thread in the JVM. From this view you can request a snapshot, reconfigure the profiler through 'On-The-Fly Profiling' and pause and resume all threads. You can dynamically take a snapshot at any point in your application. When the application completes a final snapshot is taken by default.

Enerjy Performance Profiler displays timing results for each profiled method in clean searchable tabular format. The table can be sorted by any of the column headings. Click on any method in the main view and the methods called are displayed in the outline pane. Double-click on any method and you are taken directly into the source code at the entry point for that method.

Displaying results with Enerjy Performance Profiler
Figure 5: Displaying results with Enerjy Performance Profiler

The results are displayed in both percentage of time and real time (milliseconds) that a particular method has taken against the Profiled method selected. Therefore, whatever method you select to be profiled should be listed at 100%. Its children (other methods called) plus the activities within itself [for example; setting variables or using loops (listed as 'self' in the results)] make up this 100%.

Percentages of time are more useful if you are comparing results running on different systems. Obviously the speed of the CPU and the amount of physical memory in a machine can result in faster or slower actual times being recorded but the percentages of time should be comparable.

By right clicking on the result table you can edit the columns to include more detailed metrics such as Minimum times and Maximum times for particular methods.

When approaching performance tuning, use the Enerjy Performance Profiler results sorted by '% Time'. Review the first methods taking up the most CPU cycles. Focus your attention on methods you feel will either be the quickest to optimize or where you believe an inappropriate amount of time is being spent, for example, a 'read' method taking more time than a corresponding 'write' method. Double click on the selected method, review the code and make the necessary changes. Profile again and hopefully you will find improved performance. Because Enerjy Performance Profiler integrates so naturally with your IDE, this process becomes efficient and habit forming.

Comparing Snapshots

Each snapshot you take is stored in the project directory on your hard drive. This makes it very easy to compare snapshots between builds and measure the performance improvements from within your IDE. Another convenient way to compare profiling results is to look at them side by side in a reporting tool. Simply right click on any point in the main view and select "Export table to external file". If you specify a .csv file extension, you can read the file using a spreadsheet tool such as Microsoft Excel. In the example below (Figure 6) we are comparing snapshots to determine how much faster SAX is versus DOM.

comparing two snapshots
SAX vs DOM graph showing SAX much faster
Figure 6: Comparing snapshots to determine how much faster SAX is versus DOM.

Over time these snapshots can prove how performance profiling has increased the speed or throughput of your applications and justifies any time spent in performing this tuning activity.

Remote Profiling

Enerjy Performance Profiler can easily be configured to communicate with profiling sessions that do not originate from within your IDE. These profiling sessions can be external processes run on the same machine, or processes launched from any network-accessible computer. To profile an external JVM simply download the Remote Profiling Module and install it on your server or other external computer. When starting the remote process you must include a one-line argument to the JVM (the IP address of the machine that is running your IDE, and a port number for a socket to communicate on). In the case of an application server this argument is passed in as a JVM Environmental Variable. Once the external application is started, the full complement of Enerjy Performance Profiler features can be used to profile these remote applications.

Performance Awareness: You Know It Makes Sense

An enormous number of applications in use are not running as fast as they could. Throughput is never as high as it could be. The simple fact is the first release of an application is never the most optimized.

At trade shows, technical seminars and Java exhibitions throughout 2004 there is a steady increase of interest in this area. Both vendors and number of developers attending booths have been on an increase. Articles and feature points within other articles not directly associated with profiling or performance tuning have also become more popular.

In the industry, customers (internal and external) are expecting to see profiling/performance tuning stages in the Project Plan and project managers are budgeting for this. As developers, you are ultimately responsible for the code base so you will have to decide how to approach this, but remember ? arm yourselves with the right tools.

IDE Support

Currently Enerjy Memory Profiler supports the following IDEs:

About Enerjy Software

Our Tools: Enerjy's suite of Java tools strives to provide tactical, comprehensive, and?at their heart?useful solutions for the everyday Java developer. Our tools keep you inside your IDE, where you spend eight (ten?) hours a day, and get you back to your curly braces and semicolons, where the work really matters. You'll get simple-to-read tables and easily recognized graphs, and you'll always be a double-click away from your code.
Our Company: You'll find that we're a little different from other software tools companies. Instead of trying to sell you everything, an all-encompassing development solution, we're maniacally focused on giving you just the help you need, when you need it, and then getting out of your way. And we won't charge you an arm and a leg for our tools. We've built the company from the ground up with a view to keeping costs under control and passing those savings on to you.
For more information on Enerjy Performance Profiler, please visit: Enerjy Performance Profiler


Last Updated: 2005-03-31
Copyright © 2000-2005 Jack Shirazi. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries. JavaPerformanceTuning.com is not connected to Sun Microsystems, Inc. and is not sponsored by Sun Microsystems, Inc.
URL: http://www.JavaPerformanceTuning.com/tools/enerjyPP/index.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us