Analysis from four dimensions: factors that affect Java performance, dimensions of java
With the rapid development of the Internet industry, website interface design has become increasingly cool. It is true that the visual impact will play a significant role in website traffic. However, if the backend service does not meet the burst concurrency, the user experience will become very poor.
As we all know, it is not easy to build a website. Currently, Java is also one of the most common programming languages for developers, and many enterprise IT companies are highly dependent on Java. Too many websites may sound cruel because of the failure of Java performance, but this is an indisputable fact. So the question is, what causes these performance problems? How can we quickly find the root cause of performance problems?
For Java developers, OneAPM's Application Insight is an essential Java performance optimization tool. It can be divided into four dimensions: "1. web transactions; 2. database; 3. external services; 4. background tasks are used to analyze every action of the application during system running. For example, when users access an application, each step of the Operation gives you a clear picture of how much time is consumed, how much resources are occupied, and provides historical data for your reference and comparison, you can clearly understand the running status of your application.
Generally, we need to take two steps to manage performance: 1. performance problem discovery; 2. Performance problem optimization. Application Insight first finds the root cause of the performance problem, and the subsequent performance optimization process will become very simple. OneAPM can also accurately locate the root cause of performance problems from multiple dimensions and provide final solutions. :
In the response time overview view, we can clearly see the consumption of the response time corresponding to the four dimensions "Web transactions, databases, external services, and background tasks". Next, we can perform in-depth analysis on the time consumption of each dimension.
1. Web transactions
We can see from the view that the slow Web Transaction Response time ratio, average response time, performance index, throughput, and so on, at the same time, the Web transaction will be sorted according to the time length, it is displayed in the form of a list, so that you can easily find out which Web transactions take a long time to execute, and you can see the top five Web Transaction Response time line charts provided.
Then, we can preliminarily judge the user experience during operations based on the performance index data provided by Web transactions. What is the time spent in the execution of Web transactions. More importantly, Application Insight also provides the slow Transaction Tracking function. Click the name in the slow Transaction Tracking list to view details, such:
This data view shows the details of the four indicators "summary, details, parameters, and SQL" of the tracked slow transactions. By clicking "details, the Calling relationship of the entire Web transaction component and the overall time-consuming situation of each step will be displayed directly in front of you. We can also see the calling relationship of each service step, it is displayed in a tree structure. At the same time, you can expand the method tracking function to find the code lines that are time-consuming, including HTTP requests. During the execution of the entire Web transaction, we will display the performance analysis results in a view to see how each piece of code is executed, and the usage of the resources it occupies.
2. Database
From the database view, we will sort database operations in the format of Table Name and SQL operation type according to the response duration, the time-consuming data is displayed in a list, and the average response time, total response time, and throughput of each database operation are displayed, in this way, you can find out the SQL statements that take a long time to exclude Web transactions. OneAPM also provides the Top 5 database operation Response Time View, as shown in:
Through the chart data, we can dynamically see the overall consumption of application performance for each database operation. In addition, we provide slow SQL tracking for slow database operations,
From this view list, we can see the timestamp and time consumption of slow SQL statements. You can also click the slow SQL name to continue tracking the details of this SQL statement, such:
Here, we can see the detailed SQL statements and their execution times and ranges, and the data provided by the slow SQL tracking function, it is very easy to find the cause of slow SQL. Of course, because these SQL statements are related to business creators, it is easy to determine whether it is a program or O & M problem. If it is a program problem, OneAPM provides the Web transaction for this operation. If it is an O & M problem, it also provides the slow SQL tracking function. In general, we can optimize our applications based on the cause of the problem, so that the efficiency will inevitably be greatly improved.
3. External Services
Through this chart, we can see the average response time and throughput of third-party services called through WebService and Rest, and the time consumed when calling interfaces, each external service call also provides a data view, as shown in:
Response time and throughput diagram: displays the response time and throughput changes of the external service.
Caller time proportion diagram: shows the transaction execution time of calling the external service.
Transaction list: displays the transaction execution time, response time, and number of calls to the external service.
From the above data, we can draw a conclusion that in terms of performance consumption, time consumption mainly occurs in method calling or interface calling. With these performance data, we can quickly locate the root cause of the application performance problem, and then solve the problem easily.
4. Background tasks
In the background task view, we can see the time-consuming tasks in the application, including the average response time, performance index, throughput, and response time ratio of each task. Then, in the background task dimension, we can find those time-consuming execution tasks and provide the corresponding Top 5 back-end task response time, throughput, CPU usage, and other dynamic line views.
From this, we can find out the bottleneck of non-HTTP request methods for a large amount of system performance, and then according to the Top 5 Response views provided by background tasks, you can intuitively see the background tasks that seriously consume performance, CPU usage, and memory usage.
By analyzing the performance consumption of background tasks, we can also find scheduled tasks that consume more resources and optimize time-consuming tasks reasonably, so that the application will become smoother.
In general,
Through in-depth analysis of the four dimensions of "Web transactions, databases, external services, and background tasks", we can easily find the reasons that affect the slow Java System. After discovering these causes, we can perform system optimization again, and the entire process of troubleshooting will be much simpler.
If you are very concerned about the dimension of system performance consumption, or if your application has encountered serious performance problems and you still cannot find the cause, register a OneAPM account, install Application Insight! Whether you do O & M, development, or testing, we believe that using Application Insight will surely bring surprises and gains to your work.