In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "ASP.NET website performance optimization method is what", in daily operation, I believe many people in ASP.NET website performance optimization method is what problem there are doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation method, hope to answer "ASP.NET website performance optimization method is what" doubts helpful! Next, please follow the small series to learn together!
Learn common website performance optimization tips
First of all, we need to learn some theory and basic knowledge of optimizing website performance and experience. Yahoo has summarized it for us. For details, see several articles in the reference link. Some kind people have translated it into Chinese. Some of the skills mentioned here are very operational, it is recommended that every website developer carefully study and practice, it can be said that do not understand the optimization skills, improve the front-end performance of the website can not talk about.
Diagnosing website performance
To optimize the front-end performance of your website, first look at the bottlenecks that affect front-end performance the most. The most commonly used tools are Google's Page Sped and Yahoo's YSlow, both of which are used under Firefox and are based on FireBug, which is a must-have plugin for front-end developers.
These two tools can help you diagnose where the performance bottleneck of your page is, such as how much network traffic is consumed to open the home page of your site, how many HTTP requests are made, whether each page component can be cached, how much time each execution process of page loading takes, whether there is blocking in loading, how page components are loaded in parallel, whether images can be compressed lossless, whether scripts and styles are placed in reasonable positions, Whether unnecessary white space has been deleted, whether gzip compression has been carried out, etc. Knowing this information, you can have targeted website performance optimization, first optimize the place that most affects performance.
These two tools are also easy to use.
Practice optimization
According to my study and practice of website optimization, I summed up some experiences: Generally, website performance consumption is concentrated on network downloads, including the download of HTML and images, scripts, styles and other components of the page itself, especially when the network speed is relatively slow. Downloading these things takes most of the time for the entire web page to be rendered. After these things are downloaded, local rendering and presentation will generally be very fast, unless there are very complex effects or scripts. The speed of server execution depends on the logic of the specific server. Optimization is more complex. Often the site itself also has access to other servers, databases, etc. on the backend.
To solve this problem, there are two points to start with. One is to compress the page components. The images used in the web are generally compressed formats, so the compression space is not too large, and it will also take up additional server CPU. However, the compression ratio of GZIP compression for scripts, styles, and HTML is very large, and most browsers now support GZIP compression.
On the other hand, scripts, styles, images plus Http Expire header, plus this expired header, the site only needs to download these web components when it is opened *** times, and then open it without even initiating HTTP requests, directly loaded locally. Of course, scripts and style servers may change in the future. We need to use URL rewriting for automatic renaming of scripts and style references, so as to refresh the browser cache after scripts and pages are updated.
Fortunately, to achieve these two points, in IIS7 is very simple, first of all, compression, in win7 use "open or close windows function" to open IIS performance tools in the "dynamic content compression" and "static content compression," as shown in Figure 1.
Then in IIS Manager, select the website to be compressed, double-click the compression button to check the dynamic compression and static compression. By default, mimetype is text/* and application/x-javascript will be compressed. Generally, this is enough, but IIS7 defaults to mimetype of application/x-javascript for.js files, while dynamic compression is used for application/x-javascript by default. The difference between dynamic compression and static compression is that it will not be cached by IIS cache mechanism. Each access will read the file or route the request to the following module, so we need to change the mimetype of.js to application/javascript, as shown in Figure 2.
Then dynamically compress application/x-javascript and statically compress application/javascript. C: \Windows\System32\inetsrv\config\applicationHost.config needs to be configured, as shown in Figure 3.
Compression of page components has reduced a lot of network traffic and improved a lot of performance, but some scripts and styles are rarely changed in general, and every time you visit a web page, you have to download it again or consume a lot of network traffic, which requires configuring the expiration time of static files.
IIS7 Manager has an HTTP response header function. General website scripts, styles and images are placed under scripts, styles and images directories respectively. We can directly set the expiration time for files under these directories to 100 days. In IIS7 Manager, you can directly operate. See the reference link for details. We will not repeat it. After successful setting, a web.config file will be generated in these three subdirectories respectively, and cacheControlMode=UseMaxAge will be set. cacheControlMaxAge=100.00:00:00 After this setting, the optimization effect is very good. After *** times of opening the web page, it is many times faster to open the web page again than before, but there is a problem. If your style or script is modified, if the client does not refresh the page, it will not take effect.
To solve this problem, use URL Rewrite to add a timestamp to the reference path of the style and script. If the script is changed, the timestamp will change, and the referenced file name will change. The browser will download the new style, and the new style will actually be the previous name after url rewrite. For example,/scripts/base.20100111502.js is actually/scripts/base.js. For specific operations, see the reference article.
But the article said that iis6.0 is using URLRewrite component, in IIS7 there is a free rewrite module, download and install on the Microsoft website on the line, its configuration rules and URLRewrite is not the same, the most important difference is that the regular group matching is not with $1,$2 reference, but with {R:1} this format reference, there is a target url configuration does not need regular escape characters, such as ". "It is." "It doesn't have to be." If you don't pay attention to this, wait for 404. The specific use and precautions of the rewrite module under IIS7.5 can be seen in the reference link below. My configuration here is as follows:
{{{ }}} At this point, the study of "What is the performance optimization method of ASP.NET website" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.