Java Profiler Comparison

by Denis TunovićMarch 13, 2012

While maintaining one of our client’s applications I noticed some performance problems under higher load. It seems logical to think when increasing the load on the application, that the performance will decrease. However, in my case the performance decreased at a rate much higher than when compared to the increased load. I did wonder, maybe the performance could be increased by altering the application’s logic or maybe the application had reached its limit and needed to be scaled up. In order to figure this out in more detail, I decided to do some profiling to see where the application was using most of its resources and how to tackle this problem.

There are many Java profilers out there that could help me to figure out this problem, only the question was which one should I use?

In order to make the right choice, I set up some minimum requirements that the profiler should meet:

  • The layout of application flow should include classes and methods against time

  • Memory monitoring must be included

  • Usability must be featured

My setup is a Spring based application with a RESTful interface using the MongoDB as its data store. It also uses Solr for searching. The application is deployed on Tomcat server.

My options were:


VisualVM is a resource profile tool that comes with JDK starting from 6 update 7. It has default memory and CPU monitoring. It can tell you which classes and methods are hit, but it will not show the flow through the application.


JProfiler was easy to set up and it walked me through a wizard where you can select the application server used to run the application. I had to select the application server home directory and the wizard generated a separate start up script for the application server to use with JPofiler. Then I run the server and it did wait till JProfiler connected to it. I attached the session to the listening process and it gave couple options. I could record memory usage and CPU usage. I went for the CPU usage and could see the execution path. This gave me a nice overview of where the request took the most time. Using the plugin for my IDE, IntelliJ in my case, running JProfiler is even easier. I didn’t have to generate separate Tomcat startup. That was taken care of by the IntelliJ plugin.


YourKit is one of the profilers that I came across on another project. The setup was very easy. The setup gave me an option to install a plugin for my IDE. After setup I run the application using the plugin and it automatically attached the process to YourKit. It showed me a nice user interface with tabs like memory monitoring and CPU profiling. I took a snapshot of the CPU time and could see the execution path for my request.


I had some difficulties to get started with JProbe. The installation was not straight forward I did figure out the configuration eventually. It uses a similar setup like JProfiler. It generates a start up script in your Tomcat directory. I started the server through the script and attached the session to it. The interface had buttons and tables everywhere and I got lost in the UI. I did see the memory usage, but couldn’t find the execution path of my process.

Spring Insight

Hearing about the Spring Insight monitoring interface as part of the TC Server I was excited to try it out. After installing and setting up a TC Server developer edition, I deployed the application on the TC Server instance. I browsed to the Insight interface where I could monitor my application’s flow. It gave me a nice flow layout of the classes and methods. It showed me how much time the methods took to complete. I could see the values of input parameters as well as the return values. Because my application is Spring based, Spring Insight presented very useful data about my application. A TC Server plugin is available for my IDE for configuring an instance that is similar to Tomcat configuration. The SpringSource Tool Suite comes bundles with Spring Insight.


Having seen these five profiling tools, I can safely say that I am very optimistic about all their possibilities. If you have Spring based application the right choice for development is clearly the Spring Insight. It is free for development purposes, but your application needs to be deployed on the TC Server.

If you want more freedom in monitoring local and remote processes I would go for JProfiler or YourKit. These two can also assist the Spring Insight monitoring in your conquest in finding performance bottlenecks.

Both JProfiler and YourKit meet my requirements described above. JProfiler, YourKit and Spring Insight can trace the flow through the classes and methods of the application. JProfiler and YourKit show memory usage. Although Spring Insight cannot show memory usage, it shows the throughput trend nicely. These three profilers are very clear, not confusing and easy to use. And finally they have nice plugins for my IDE. Hope this little journey helps you make the right choices too.