Profiling (profiling) is a technology that focuses on measuring where server time is spent, where performance is response time.
Measurement is a challenging task, and the results of the analysis are equally challenging, measuring where the time is spent, and knowing why it is different.
profiling typically has two steps :
The time taken to measure the task;
The results are counted and sorted, and the important tasks are queued up to the front.
about profiling reports :
The task name, the execution time of the task, the time consumed by the task, the average execution time of the task, and the percentage of the task's execution time.
The profiling report is sorted in descending order by the time the task is consumed.
There are two more common situations that can lead to inappropriate measurements :
1. Start and stop measurements at the wrong time
2, the measurement is aggregated information, rather than the target activity itself
The time required to complete a task can be divided into two parts: execution time and wait time. Therefore, there are two types of profiling: execution-time-based analysis and wait-based analysis.
Execution-time-based analysis: What is the longest time to study a task?
Wait-based analysis: Determine where the task is to be blocked for the longest time
If you cannot confirm that the problem is in the execution or wait, both methods need to be tried.
There are a number of factors that can lead to performance bottlenecks:
1, external resources, such as the call to the external Web server or search engine
2, the application to deal with a large number of data, such as the analysis of a large XML file
3. Perform expensive operations in the loop, such as abusing regular expressions
4, using inefficient algorithms, such as the use of brute force search algorithm to find items in the list
a useful tool for profiling: New Relic. The following is a brief description of the use of this tool (excerpt from other pages):
Need to register a new account on the site, according to the server-side application framework choose to install the corresponding plug-in, it provides a lot of common application framework plug-in, rails as an example, only need to configure in Gemfile, execute the Bundle install:
Gem ' newrelic_rpm '
then download the corresponding NEWRLIC.YML configuration file, put it into the application directory, and make some parameter adjustments. After you redeploy the app, wait a few minutes for the plug-in to collect performance-related data, and then visit the Newrelic website to see a variety of charts.
Detailed content can go to its official website to study for oneself: https://newrelic.com/
This article from the "Linux Learning" blog, reproduced please contact the author!
Server Profiling (profiling)--Introduction