A JVM monitoring tool is also known as a Diagnostic Tool may be needed to fine-tune your Java application for performance, reduce memory footprint, avoid contention/deadlocking etc. As such selecting a right tool is very important. There are a number of commercial and open source software available today. We would try to see the features and benefits such tool should provide, helping to narrow down the choices.
Benefits of Diagnostic Tool
- Optimize application performance.
- Improve application stability and uptime.
- Reduce system resource usage.
- Reduce the time to resolve problems.
- Drive down development and maintenance costs.
Issues that Diagnostic Tool can solve
- Identify if native or heap memory is leaking.
- Discover which methods are taking the most time to run.
- Pin down I/O bottlenecks.
- Visualize and tuning garbage collection.
- View any lock contentions.
Features of Diagnostic Tool
The tool should have very low overhead monitoring impact. It should be able to run alongside Java application with a very small impact on the application's performance. This is very most of the tools fails, instead of monitoring silently they would act like a hog and eat away memory and consume a lot of CPU cycles. The tool should monitor several application areas, using the information to provide recommendations and analysis that help you improve the performance and efficiency of your application. Data obtained from monitoring an application should be available for analysis at a later date. The diagnostic tool should provide visibility, monitoring, and profiling in the following application areas:
Performance Java method profiling: The tool should provide method profiling to diagnose applications showing high CPU usage. It's low overhead which means there is no need to specify in advance which parts of the application to monitor, It works without recompilation or bytecode instrumentation and shows where the application is spending its time, by giving full call stack information for all sampled methods.
Lock analysis: Synchronization can be a big performance bottleneck on multi-CPU systems. It is often difficult to identify a hot lock or assess the impact locking is having on your application. The tool should look for all locking activity and identifies the objects with most contention.
Garbage collection The performance of Garbage Collection (GC) affects the entire application. Tuning GC correctly can potentially deliver significant performance gains. The tool should identify where garbage collection is causing performance problems and suggests more appropriate command line options.
Memory usage The tool should be able to provide insight into size, time and code location of object allocations to analyze the memory footprint.
System Environment The tool should provide Environment details of the Java version, Java classpath, boot classpath, environment variables, and system properties. This is particularly useful for identifying problems on remote systems or systems where you do not control the configuration.
Java Class loading The tool should provide class loading information, showing exactly when a class has been loaded and whether it is cached or not. This helps you determine whether your application is being affected by excessive class loading.
File input and output The tool should monitor application input or output (I/O) tasks as they run. Provide details information about how many and which files are open, and to help solve problems such as when the application fails to close files.
Real-time Monitoring The tool should provide all of the above insights about in the real time when the JVM is running without impact the overall performance.
Tip Irrespective of that based on past experience the developer should try to test this tool in isolation in a controlled environment.