In continuation to my previous blog (http://bit.ly/2o9gqM6) which was on Java performance optimization tips, here are a few Java tools which are widely used to collect and detect performance bottleneck in the application.
JProfiler an extremely good Java profiler combining CPU, memory and thread profiling into one application and is useful for developers as it can be used to analyze performance bottlenecks, memory leaks, CPU loads, resolve threading issues. It supports local profiling (analysis of applications that are running on the same machine on which the JProfiler software is installed) and remote profiling (this is where it allows for the analysis of Java applications which are running on remote machines which JProfiler software is not installed on.).
JProfiler is a commercially licensed Java tool developed by ej-technologies GmbH and is mainly designed for use with Java EE and Java SE applications. Dedicated support for JEE is present in most views in JProfiler. For example, in the JEE aggregation level, you see the call tree in terms of the JEE components in your application. In addition, the call tree is split up for each request URI. Also, with its JEE support, JProfiler bridges the gap between a code profiler and a high-level JEE monitoring tool.
Finding a memory leak can be impossible without the right tool. JProfiler's heap walker offers you an intuitive interface to solve both simple and complex memory problems. Five different views and lots of inspections show different aspects of the current set of objects. Each view provides you with essential insights into the selected objects and lets you switch to different objects sets. Questions like why objects are not garbage collected are answered with a single click of the mouse.
VisualVM is a tool derived from the NetBeans platform and its architecture is modular in design meaning it’s easy to extend through the use of plugins.
Visual VM allows you to get detailed information about your Java applications while they are running on a Java Virtual Machine (JVM). Data can be generated and retrieved by the Java Development Kit (JDK) tools and all the data and information on multiple Java Applications can be viewed quickly on both local and remote running applications. It is possible to also save and capture the data about the JVM software to the local system, and then view the data later or share it with others.
Visual VM can do CPU profiling, Memory profiling, run garbage collections, take snapshots, and more. VisualVM organizes data about the JVM software that is retrieved by the Java Development Kit (JDK) tools and presents the information in a way that enables you to quickly view data on multiple Java applications. You can view data on local applications and applications that are running on remote hosts. You can also capture data about JVM software instances and save the data to your local system and view or share the data with others.
VisualVM can take the following types of profiler snapshots
Memory Snapshot: A memory snapshot captures profiling data on allocated objects. You can take a memory snapshot when you are using the profiler to analyze memory usage.
CPU Snapshot: A CPU snapshot captures data on the performance of the application. You can take a CPU snapshot when you are using the profiler to analyze application performance.
Memory Analyzer Tool (MAT)
The Eclipse Memory Analyzer is a Java heap analyzer that helps you find memory leaks and reduce memory consumption. It is more suited for being a general-purpose toolkit to analyze Java heap dumps and calculation of its size. It can be used also to reports leak suspects and memory consumption anti-patterns.
The Eclipse Memory Analyzer Tooling (MAT) is a set of plug-ins for the Eclipse IDE which provides tools to analyze heap dumps from Java application and to identify memory problems in the application. The Eclipse Memory Analyzer helps the developer to find memory leaks and high memory consumption issues. It visualizes the references to objects based on Java heap dumps and provides tools to identify potential memory leaks
It is possible to instruct the JVM to create automatically a heap dump in case it runs out of memory, i.e. an out of memory error. To instruct the JVM to create a heap dump in such a situation, start your Java application with the -XX:+HeapDumpOnOutOfMemoryError option.
After a new heap dump with the .hprof ending has been created, you can open it via a double click in Eclipse. If you used MAT to create the heap dump, it should be opened automatically.
The overview page allows you to start the analysis of the heap dump. The dominator tree gives quickly an overview of the used objects.
See all Java performance metrics in real-time. Dynatrace captures every transaction, across every tier, without gaps or blind spots. Pre-configured dashboards provide all relevant metrics down to the SQL statement and code level. In under five minutes, our agent automatically discovers your entire Java application stack. Improve the performance of your Java code with continuous insights into your applications.
Follow every single transaction, end-to-end
Dynatrace uses patented PurePath Technology® to capture timing and code-level context for every transaction, across every tier, without gaps or blind spots.
Drill into all services and components called upon a single user interaction. Analyze response times and find hotspots at the method level. Understand the impact of methods and database statements on user experience with our unique backtrace capability.
Dynatrace provides Java monitoring for applications running in Tomcat containers as well as JBoss, WildFly, GlassFish, WebSphere, and other servers.
Dynatrace tells you the root cause of Java problems!
Dynatrace detects and diagnoses problems in real-time, pinpointing the root cause down to the offending code before your customers are even affected. Detect availability and performance problems across your stack proactively. Dynatrace directly pinpoints components that are causing problems with big data analytics of billions of dependencies within your application stack. A visual replay of problem evolution helps you understand how problems evolved over time.