Performance Analysis Tools



Availability of good profiling and monitoring tools are essential for performance analysis and I thought I'll blog today about some of the tools that I use.

Sun offers a couple of awesome free tools that developers can use for performance analysis - The Sun Studio Performance Analyzer that is part of Sun Studio 11 (yes, it is available for use for free) and the Netbeans Profiler.

Sun Studio Performance Analyzer
Collector/Analyzer within Sun Studio is my primary profiler to identify performance bottlenecks and synchronization issues in Java applications. Profiling using Collector/Analyzer is a two step process. The profile data is first collected using the 'collect' command (usage: collect collect-options program program-arguments). The data can then be analyzed using the graphical data-analysis tool, 'analyzer'. The analyzer can show function, caller-callee, source, and disassembly data, as well as a TimeLine showing the profiling events in time-sequence. A sample screen shot is shown below. 'Exclusive time' (first column in the output) is the time spent in a method, excluding time spent calling other methods and 'Inclusive time' (second column) is the time spent in a method including time spent in other methods. A good way to start is by focusing on methods with high exclusive time values.

Analyzer screen shot

For more details, refer to the detailed documentation. Collector/Analyzer is supported on both Solaris and Linux. If you do performance work on Solaris or Linux, download it and check it out.

Netbeans Profiler
I first tried the Netbeans Profiler about a year or so ago. It was fairly complicated to set up (it required a customized JVM at that time), had some stability issues and I could not get it to work consistently. Recently, I tried the latest version, Netbean Profiler 5.0 RC2 on JDK 6.0. Wow!!! I was blown away, it is so slick. All you need to do to get started is to add an argument (-agentpath:path_to_profiler_lib/deployed/jdk15/solaris-sparc/libprofilerinterface.so=path_to_profiler_lib,5140) to your Java startup script. There is an 'Attach Wizard' that walks you through it. It was so easy that I was up and running within a few minutes.

The best part I liked about the NB Profiler was the fact that you can profile just a selected part of your application. This allows you to concentrate your performance analysis to a section or module within your application rather than profiling the entire application. This functionality came in very handy when I wanted to look at just the XML parsing performance of an application where the XML processing was only a small piece of the entire application (it accounted for about 20% of the performance). This 'module only' profiling can be easily done by selecting the 'Part of Application' button in the Analyze Performance section. If you use this mode, you will need to select the starting root methods (entry points into the module that you are interested in profiling). Since I had already collected profiles using the Collector/Analyzer, I could easily find this information from the stack traces that Analyzer provided.

A screen shot from the NB Profiler is given below. The Hot Spots tab shows you both the method's self time, the time spent in all invocations of this method (excluding further method calls), and the number of invocations. The number of invocations allows you to identify the most frequently called methods and improving the performance of some of these methods methods may improve the performance of the application significantly.

Analyzer screen shot

NB Profiler can also do memory profiling. I plan to write about this in more detail some other time.

JVM Monitoring Tools
Since JDK 5.0, the JVM bundles several monitoring and management tools. The one that I use regularly is jstat . jstat provides a wide variety of statistics including the summary of garbage collection statistics (option: gcutil) and Hotspot compilation method statistics (option: printcompilation). The printcompilation option is very useful to identify how long the warmup period of your benchmark needs to be. For server side benchmarks, it is good practice to ensure that all the compilation has been completed before performance data is collected during the steady state period of the benchmark.

JVMstat is another excellent JVM performance monitoring tool. It includes visualgc, a visual garbage collection monitoring tool (see screen shot below). visualgc is also available as a module within Netbeans.

Analyzer screen shot

Solaris System Tools - UltraSPARC T1
Most of you are familiar with Solaris system tools like vmstat and mpstat to monitor system utilization. However, you have to be a little careful while interpreting these results if you run the tests on an UltraSPARC T1 based system (T1000/T2000). Ravi Talashikar has written an excellent blog titled UltraSPARC T1 utilization explained, that explains this in great detail.
Comments:

Post a Comment:
Comments are closed for this entry.
About

binu

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today