During the maintenance of the application to the customer, I noticed some performance issues under high load. In theory, increasing the load on the application can degrade performance ratios. However, I think the rate of performance degradation is much higher than the load. I also found that performance can be improved by changing the logic of the application, or even reaching the limit. In order to understand this in more detail, we need to do some performance analysis ...
In the process of application maintenance to customers, I noticed some performance issues with high load conditions. Theoretically, increasing the load on the application will degrade performance, but I think the rate of performance degradation is much higher than the load, and I also find that performance can be improved by changing the logic of the application. In order to understand this in more detail, we need to do some performance analysis, when we will naturally use some performance analysis tools. Java has a lot of performance analysis tools that can help us figure this out, but which tool should we use?
To make the right choice, I listed performance analysis should meet some of the minimum requirements:
- Must include monitoring of the class, method, and time of the application
- Must include monitoring of the memory
- Must have ease of use
I configured a spring application that uses a restful interface, uses MongoDB as the data store, uses SOLR to search, and deploys on the Tomcat server.
Reference tools:
1.VisualVM
VISUALVM is a resource analysis tool that has been updated from JDK 6 to 7, which defaults to memory and CPU monitoring, which can tell you which classes and methods consume resources, but it does not show code flow.
2.JProfiler
Jprofiler is easy to install, and through the wizard you can choose the application server to run the application. I have to choose to use the home directory of the Jpofiler application server and a separate startup script generated by the wizard. Then run the server. During a listening session, it provides several options for recording memory usage and CPU usage. While viewing the CPU usage, you can see the execution path. This allows me to see that the application spends most of its time on requests. We can install the IntelliJ plug-in to the IDE, so it is more convenient to run Jprofiler. For example, you can start Tomcat directly for me.
3.YourKit
Yourkit is a performance analysis tool that I stumbled across in another project, and it's easy to install. There is an option to install a plugin to my IDE. After installation, run the application, use the plugin, and it will automatically connect to the Yourkit. It has a nice user interface to view memory and CPU monitoring, as well as to see the execution path of the request.
4.JProbe
I had some difficulty when I first started creating jprobe. The installation is not done directly, I need to configure it. It uses settings similar to Jprofiler. It will generate a startup script in your Tomcat directory, which can be scripted to start the server and listen to the session. Its interface contains buttons and tables that can see the use of memory, but cannot find the execution path in the process.
5.Spring Insight
I was excited to hear that TC server had a Spring Insight monitoring interface. After the installation is complete and set up as the developer version of TC Server, then deploy the application on the TC server. I look at the Insight interface, which is a good way to monitor classes and methods, and see how much time is spent to complete this method. I can also see the input parameter values, as well as the return values. Since my application is spring-based, spring insight can provide very useful data. The TC server plug-in configuration is similar to Tomcat's configuration on the IDE. The SpringSource tool kit comes with spring Insight.
Conclusion
Seeing these five performance analysis tools, I can say with certainty that they are all very good. If you have a spring-based application, then choosing Spring Insight is obviously the best. It is always free, but you need to deploy your app on TC server.
If you want to listen to local and remote processes, I will choose Jprofiler or Yourkit. These two can also help spring insight to monitor and find performance bottlenecks.
Jprofiler and Yourkit have been able to meet my above requirements. Jprofiler, Yourkit, and spring insight can track the flow of classes and methods of your application. Jprofiler and Yourkit can show memory usage. Although spring insight does not show memory usage, it can show the trend of throughput very well. These three performance analysis tools feature clear, clutter-prone and easy-to-use features. Finally, they all have their own IDE plugin. Hopefully this article will help you make the right choice.
Comparison of several performance analysis tools in Java