In this post, we will cover some of the popular and best Java Profilers. We will be covering following Java Profilers in our post.
As a developer, we always try to write best and efficient code.While writing code for complex and enterprise applications, we may want to get an understanding of the JVM internals
Debugging these kinds of performance issues is always challenging and if these are happening only in a specific environment (say your production environment ) is not difficult but sometimes not feasible.
Java Profiler is a tool which can help us in all these cases.These profilers work at the JVM level and hook themselves to Java bytecode operations.
This post is intended to give an overview of the Java profilers and will not cover features in detail. Please refer to feature section on the product home page.
Jprofiler is one of the most used Java Profiler for Java-based standard and enterprise applications.Jprofiler provides plugins to work with all of the popular Java IDEs.
Some of the main features of Jprofiler are
This is how Jprofiler interface looks like
As mentioned above, Jprofiler provides a way to integrate with all popular Java IDEs.It also provides an option to integrate with the remote machine.
Let’s cover some of the main features of Jprofiler
If we want to get an understanding of the memory usage and call hierarchy for the given session, we can click on “all Objects” under Live memory link.
JProfiler offers various ways to record the call tree to optimize for performance.
Jprofiler provides good support for JDBC, JPA/Hibernate, and other popular databases.
If you want to try, you can get trial copy of Jprofiler
Yourkit is one of the mature and best Java profilers.YourKit core features include
For more detailed about the features, please refer YourKit Features
Here is a sample dashboard for our Spring Boot based REST application
Performace chart shows all telemetry graphs in the same place to give you a complete picture of the system
Thread view gives complete pictures of the application’s thread with an option to show “Live”, “Live and Finished” and “Finished” thread view.
One of the main features of Yourkit is its ability to profile thrown Exceptions.
Please refer to YourKit site for getting trial license
Java VisualVM is profiler tool provided by Java Development Kit (JDK).VisualVM relies on and works closely with some of the other tool provided by JDK to get all this data.It has the capabilities to detect all running local and remote VM’s.It also gives the option to configure an additional connection using JMX.
Here is the default layout of Java VisualVM
Some of the features offered by the Java VisualVM are
VisualVM provides detailed overview of the threads with an option to filter out results based on the requirements
VisualVM also provides an option to take a snapshot of the profiling session.This snapshot can be used at the later stage of the analysis.
One of the advantages of VisualVM is that it comes with JDK.We don’t have to pay any license fees to use this tool
With JDK9, Java VisualVM has been moved to a new place known as GraalVM .Some of the feature provided by Graal are
There are other sets of APM tools which provide a different kind of Java profiling for your applications.
Some of the popular and widely used APM solutions are
These tools work entirely different way than the Java profilers explained in above section.
These tools work by installing a java agent on the host machine.These agents will be responsible for sending required information back to the main server for analysis and evaluation.
These profilers agents are designed for
In this post, we discussed profiling and some of the best Java Profilers.We did not cover different features of these Java Profilers as it needs a separate article for each profiler.
Choosing a profiler is dependent upon developer and the level of analysis and information required by the team.