Build high performanceASP. NETSite Chapter 5-Performance Tuning Overview (Part 1)
This article describes how to use some simple tools to analyze some data related to site performance.ArticleWe have discussed the general process of Performance Tuning. This article will introduce some methods and tools to help you get started quickly.
Links to articles:
Build high performanceASP. NETSite Opening
Build high performanceASP. NETOne site Analyze the page processing process (front-end)
Build high-performance ASP. Net Site 2 optimize HTTP requests (front-end)
Building a high-performance ASP. Net site depends on the three details
Building a high-performance ASP. Net Site Chapter 5-Performance Tuning Overview (previous)
Design of large-scale high-performance ASP. NET System Architecture
Building a high-performance ASP. Net Site Chapter 5-Performance Tuning Overview (Part 1)
Building a high-performance ASP. Net Site Chapter 5-Performance Tuning Overview (Part II)
Building a high-performance ASP. Net Site Chapter 6-performance bottleneck diagnosis and preliminary optimization (Part 1)-identifying performance bottlenecks
Build a high-performance ASP. Net Site Chapter 6-performance bottleneck diagnosis and preliminary optimization (next article)-simple Optimization Measures
Building a high-performance ASP. Net Site Chapter 6-performance bottleneck diagnosis and preliminary optimization (next article)-reducing unnecessary requests
Building a high-performance ASP. Net Site Chapter 7 how to solve memory problems (previous article)-Managed Resource Optimization-in-depth analysis of the garbage collection mechanism
Building a high-performance ASP. Net Site Chapter 7 how to solve memory problems (previous article)-Managed Resource Optimization-monitor CLR Performance
The topics in this chapter are as follows:
General performance tuning process
Analyze page loading information using analysis tools
Analyze performance bottlenecks using analysis tools
Analyze and load page information using analysis tools
After all, the optimization of the site is the optimization of every page of the site, even if the page of the site is displayed to the user's eyes faster. So before that, let's take a lookWebPage components:
1. htmlFile:InASP. NETMedium,HtmlFiles are usually parsed. AspxPage. This parsing process is performed on the server and consumes most of the server's resources.
2.Images andFlashFiles: A website usually contains many such files.
3. jsAndCSSFiles: these files can prevent page rendering.
After understanding the components of the page, we can classify the factors that slow the page loading into the following categories:
1.The server spends a lot of time Parsing. AspxThat is to say, the server generatesHtmlThe text takes too long (there are many reasons for this problem, for example, the database query is slow, which affects page generation ).
2.Transfer Between the server and the browserHtmlText takes a lot of time (for example, viewstate in a page is large and the network is slow ).
3.Images andFlashFile loading takes a lot of time.
4.JSAndCSSLoading takes a lot of time.
To make the loading of a page faster, we need to know which of the above processes affects the speed.(Subsequent articles in this series will be detailed). Once we know that this type of problem causes performance problems, we can take the right remedy.
Next we will use some tools to simply view and analyze the performance of the site, so that you can quickly learn how to perform simple performance analysis.
The waterfall chart is used to analyze the loading time of each part of the page. For example, the following figure shows the analysis graph (partial) loaded on the homepage of the blog garden ).
We can know the loading time of each file through the "timeline" in the figure. The longer the timeline, the longer the file will be loaded.
After reading the above figure, you should be very curious about how the above figure is generated. The following describes some tools for generating a page to load a waterfall chart.
Let's first take a look:Firefox + firebug
Firefox:Http://www.mozilla.com/en-US/firefox/
Firebug:Http://getfirebug.com/
The following describes how to generate a waterfall chart for page loading (skip this section if you are familiar with this process)
1.OpenFirefoxAnd then pressF12,The following figure is displayed:
2.InFirebugIn the select Network drop-down box, select enable ".
OKNext, let's take a detailed look at some data in the waterfall diagram and the meaning of the illustration.
1.Request and Response Information
Click"+"As follows:
SymbolAfter expansion, we can see all the request and response headers, as shown below:
2.Timeline Information
When we move the mouse over the colored timelineBarAt the above time, we can see the detailed information of the time spent in the request for this file, as follows:
We use a table to describe the meaning of each time period:
domain name resolution |
the ip address time spent on the address |
establish a connection |
open the TCP time spent on the Link |
send request |
the time it takes for the browser to send a request. It may be a bit strange: Why is the request still waiting? Didn't the request be sent when the connection is opened? In fact, the browser will put the request for the file to be requested in the Request queue, the queue length is generally limited, if the page needs to request a lot of files, if the maximum number of queues is reached, subsequent file requests will wait. |
wait for a response |
time taken by the client to send a request until the first byte of the server is accepted |
Accept data |
time taken to accept the entire request file or data |
'domaincontentloaded' event |
starting from this request, DNS addressing the DOM of the entire page the time it took to download. Note: At this time, only the skeleton of the page has been downloaded. Some of the resources (for example, JS ) not downloaded. After downloading the Dom on the page, you can see the page, however, some resources are still being downloaded. |
'load' event |
starting from this request, DNS addresses all (including resources) downloaded from the entire page. Time spent. |
3.Page-level request information
That is, some summary information of the requests on the whole page.
OK. Let's talk about this today.Analyze performance bottlenecks using analysis tools, Use the waterfall diagram above to analyze some common performance problems. These performance problems will be given a solution in subsequent articles. Stay tuned! :)