Improve IIS Web server performance 2-point considerations (Cache +gzip) _win server

Source: Internet
Author: User
Tags metabase

First, the use of caching, that is, content expiration

Enabling content expiration for static files can improve access performance. First, the site's directory to be divided into reasonable, pictures, CSS, JavaScript are placed in a separate directory, and then select the directory in IIS, point attribute-http header, enable content expiration, you can choose 30 days after the past, so that the user browser will compare the current date and due date, To decide whether to display cached pages or requests for updates from the server, because pictures, CSS, and JS usually have less change, so they are basically read from the local cache, which speeds up the display.


Select Directory in IIS, point attribute-http header, enable content expiration

There are two requirements for this:
1, reduce the number of HTTP requests, modify the site code, reduce the number of external pictures, CSS, JS and other files, manually merge multiple css/javascript files.
2, the use of external JavaScript and CSS, all JavaScript and CSS are made into the form of external files to reference, mainly to make these files can be cached by the browser.

Second, enable gzip compression, increase access speed

HTTP compression is a way to transfer compressed text content between a Web server and a browser. HTTP compression uses a common compression algorithm such as gzip compression HTML, JavaScript, or CSS files. The biggest benefit of compression is that it reduces the amount of data transferred by the network, thereby increasing the access speed of the client browser.

Using the method, right-click the Web site-properties and select services. In the HTTP Compression box, select Compress static files, and the temporary directory suggests that you set the directory for the other disk separately, and give write permission to the IUSER_ computer name.


HTTP Compression "box" select "Compress static file

Then, in IIS Manager, right-click "Web Service Extensions"-"Add a new Web service extension", enter "Httpcompression" in "extension", and add "required files" as C:\WINDOWS\system32\inetsrv\ Gzip.dll, where the Windows system directory may vary depending on your installation, select Set extended status to allow.

Web Service Extensions

Finally, modify the MetaBase.xml file and open the C:\Windows\System32\inetsrv\ using a text editor MetaBase.xml, in the search for hcfileextensions (a total of two), and add the need to compress the static file suffix name, the default for HTML and TXT file, and add a suggestion add JS, CSS, and so on, do not need to be added pictures or zip, such as the default has been compressed files.

Typically, however, MetaBase.xml files cannot be modified because IIS is using the file, so you need to stop IIS. How to: From the Start menu, click Run. In the Open box, type cmd, and then click OK. At the command prompt, type iisreset/stop, and then press Enter. Leave the Command window open. Use a plain text editor such as Notepad to open the MetaBase.xml file, which can be saved directly after editing, or overwritten with a file that has already been edited. Finally, open IIS, at the command prompt, type iisreset/start, and then press Enter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.