During application maintenance for the customer, I noticed some performance problems under high load conditions. Theoretically, increasing the load on the application will reduce the performance, but I think the performance drop rate is much higher than the load increase. At the same time, I also found that, performance can be improved by changing the logic of the application. To learn more about this, we need to perform some performance analysis. At this time, we naturally need to use some performance analysis tools. Java has many performance analysis tools to help us figure out this problem, but which tool should we use?
In order to make the right choice, I listed performance analysis should meet some minimum requirements:
Must include monitoring of application classes, methods, and time
Memory monitoring must be included
Must be easy to use
I have configured a Spring application that uses RESTful interfaces, uses MongoDB as the data storage, uses Solr search, and deploys it on the Tomcat server.
Reference tools:
1. VisualVM
VisualVM is a resource analysis tool that has been updated from JDK 6 to 7. It monitors memory and CPU by default. It can tell you which class and method consumes resources, but it does not display the code flow.
2. JProfiler
JProfiler is easy to install, and you can select the application server to run the application through the wizard. I have to select the main directory of the JPofiler application server and a separate STARTUP script generated by the wizard. Then run the server. During the session listening process, it provides several options, which can record the memory usage and CPU usage. While viewing the CPU usage, you can see the execution path. This shows that most of the application's time is spent on requests. We can install the IntelliJ plug-in on the IDE, so it is more convenient to run JProfiler. For example, you can help me start Tomcat directly.
3. YourKit
YourKit is a performance analysis tool that I accidentally found in another project. It is easy to install. There is an option to install a plug-in to my IDE. After installation, run the application. With this plug-in, it will automatically connect to YourKit. It has a beautiful user interface that allows you to view the memory and CPU monitoring, as well as the request execution path.
4. JProbe
I encountered some difficulties when I first created JProbe. The installation is not completed directly. I need to configure it. It uses settings similar to JProfiler. It will generate a STARTUP script in your Tomcat directory. You can use the script to start the server and listen to sessions. The Interface contains buttons and tables. The memory usage is displayed, but the execution path cannot be found in the process.
5. Spring Insight
When I heard that the TC Server has the Spring Insight monitoring interface, I tried it excitedly. After the installation is complete, set it to the developer version of the TC Server, and then deploy the application on the TC Server. I checked the Insight interface, which can monitor classes and methods well and see how long it took to complete this method. I can also see the input parameter values and return values. Since my application is based on Spring, Spring Insight can provide very useful data. The configuration of the TC Server plug-in on IDE is similar to that of Tomcat. SpringSource tool kit comes with Spring Insight.
Conclusion
I can certainly say that these five performance analysis tools are all very good. If you have Spring-based applications, it is obvious that Spring Insight is the best choice. It is always free, but you need to deploy your application on the TC Server. Www.2cto.com
If you want to listen to local and remote processes, I will select JProfiler or YourKit. These two can also help Spring Insight to monitor and find performance bottlenecks.
JProfiler and YourKit can already meet my above requirements. JProfiler, YourKit, and Spring Insight can trace the flow of classes and methods of applications. JProfiler and YourKit can display memory usage. Although Spring Insight cannot display memory usage, it can display the throughput trend well. These three performance analysis tools are clearly functional and easy to use. Finally, they all have their own IDE plug-ins. I hope this article will help you make the right choices.
From: chinaitlab