Explain IIS website server performance optimization cheats thirteen articles

  

Windows Server comes with Internet Information Server (IIS) is a common tool for setting up a web server, it is a simple and troublesome thing, novices You can use IIS to set up a decent Web site, but configuring and optimizing the performance of IIS to make the site access performance optimal is not a simple matter. Here I will introduce how to optimize your IIS step by step. server.

Server-side environment, we take Windows Server 2003 IIS6.0 as an example, the client environment is Mozilla Firefox 3.0, and Yahoo's YSlow extension is installed.

YSlow is a Firebug-based plugin released by the Yahoo Developer team. It is used to analyze webpages and score according to the rules of some high-performance websites. It is very helpful for webpage performance optimization, telling you which parts affect your webpage speed and telling you how to use certain rules. optimize. Our optimization strategy for IIS is based on YSlow.

Open the target website using Firefox with YSlow installed, then click the YSlow icon and click Performance.

Where Performance Grade is YSlow's rating on your website, A (100 points) is the highest, F is the lowest, and the following is how to modify it. Below I will use IIS 6.0 as an example to introduce how to optimize website performance. .

IIS Web Server Performance Optimization Cheats 1: Reduce the Number of HTTP Requests

This is mainly to modify the website code, reduce the number of external images, CSS, JS and other files, manually merge multiple CSS/JavaScript files. . There is no need to set up IIS.

IIS Website Server Performance Optimization Cheats 2: Using CDN

For small websites, this is free. Of course, rich people can try, can technically solve the problem of slow response time for users to visit the website.

IIS Web Server Performance Optimization Cheats 3: Enable Content Expiration

Enabling content expiration for static files can improve access performance. First of all, the directory of the website should be divided reasonably. The pictures, CSS and JavaScript are all placed in separate directories. Then select the directory in IIS, click the attribute - HTTP header, enable the content to expire, you can choose to go after 30 days, so the user browser will compare The current date and expiration date, in order to decide whether to display the cached page or to request the updated page from the server. Since the picture, CSS, and JS usually change less, they are basically read from the local cache, thereby speeding up the display.

IIS Web Server Performance Optimization Cheats 4: Enable Gzip Compression

HTTP compression is a method of transferring compressed text content between a web server and a browser. HTTP compression compresses HTML, JavaScript, or CSS files using common compression algorithms such as Gzip. The biggest benefit of compression is to reduce the amount of data transmitted by the network, thereby increasing the access speed of the client browser.

To use, right click on "Website" -> "Properties" and select "Services". In the "HTTP Compression" box, select "Compress Static Files". The "Temporary Directory" is recommended to set the directory of another disk separately.

After that, in the IIS Manager, right click on "Web Service Extension" -> "Add a new Web Service Extension", enter "HTTPCompression" in "Extension", add "Required File" For C:\\WINDOWS\\system32\\inetsrv\\gzip.dll, where the Windows system directory may vary depending on your installation, check "Set extension status to Allow".

Finally, use a text editor to open C:\\Windows\\System32\\inetsrv\\MetaBase.xml, add the static file suffix name to be compressed in HcFileExtensions, the default is HTML and TXT files, it is recommended to add js , css, etc., do not add images or ZIP files that have been compressed.

IIS Web Server Performance Optimization Cheats 5: Put Style Files in the Head

This is the basic HTML code style, putting all CSS files at the head of the HTML page.

IIS Web Server Performance Optimization Cheats 6: Put Script Files at the End

This is also the basic HTML code style, putting all JavaScript files at the end of the HTML page.

IIS Web Server Performance Optimization Cheats 7: Avoid CSS Expressions

This is simple because most people never use CSS expressions.

IIS Web Server Performance Optimization Cheats 8: Using External JavaScript and CSS

All JavaScript and CSS are referenced in the form of external files, mainly to make these files available It is cached by the browser, see the introduction of the third point.

IIS Web Server Performance Optimization Cheats 9: Reduce DNS Query

Domain Name DNS Query Brings Additional Access Expenses, Reduces Host Domain Names of Files in Pages, Host Domain Names of One Page Within 2-4, this will not slow down the page loading speed.

IIS Web Server Performance Optimization Cheats 10: Compressing JavaScript Files

Compressing script files, removing unnecessary characters, can improve loading time. There are many compression tools for JavaScript files. I have A JS compression tool for GUI interface is available for download.

IIS Web Server Performance Optimization Cheats 11: Avoid Redirection

Redirection of web pages introduces additional runtime overhead, so avoid page redirects.

IIS Web Server Performance Optimization Cheats 12: Deleting Duplicate Scripts

A page containing two JavaScript files at the same time will affect the performance of the load, so you need to delete the duplicate script files.

IIS Web Server Performance Optimization Cheats 13: Configuring ETag

This is a confusing issue. In theory, deleting the ETag of the server will improve the performance of the HTTP request, but configuring IIS 6.0 according to the modification method provided by Microsoft officially has no practical effect. Finally, I used a remetag to implement the function of deleting ETag in ISAPI mode.

IIS Web Server Performance Optimization Cheats Summary

After the above-mentioned website front-end refactoring and WEB server configuration modification, our page structure has become more standardized, most of the refactored pages will be obtained. A good YSlow score, overall performance has improved a lot. For the end user, it is also obvious that the speed of visiting the website is much faster, and the browsing experience of the website has been improved.

Copyright © Windows knowledge All Rights Reserved