IIS compression is not a new technology, but for Sharepoint sites, IIS compression can play a major role. After the IIS compression function is enabled on the IIS server, before the IIS server sends the page content to the browser, It compresses the content on the server and then sends the compressed data, after the browser receives the data, it automatically decompress it and then displays it. Because the data transmitted over the network is compressed, the page content can be transmitted to the browser faster to improve the page browsing speed.
Although it takes some CPU time to compress the page content on the IIS server, this does not cause any problems for the CPU of mainstream servers. In addition, the CPU time is too low compared with the data transmission time saved. After a page is compressed each time, IIS caches the compressed files to the disk to avoid repeated compression next time.
Enabling IIS compression on the IIS server can be done through the IIS manager on the GUI, but some configurations cannot be done only through the IIS manager, we use a script tool of IIS for all management and configuration. The following commands must be executed at the command prompt on the server.
Enable static file (.js).css).html and so on) compression on iisserver:
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/parameters/hcdostaticcompression true
Enable dynamic file (. asp) compression on the IIS server:
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/parameters/hcdodynamiccompression true
Add the ". aspx" file type to dynamic File compression (all pages of The SharePoint site are. aspx). Run the following two commands:
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/deflate/hcscriptfileextensions "asp" "DLL" "EXE" "aspx"
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/gzip/hcscriptfileextensions "asp" "DLL" "EXE" "aspx"
Increase the default compression ratio by using two commands:
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/gzip/hcdynamiccompressionlevel "9"
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/filters/compression/deflate/hcdynamiccompressionlevel "9"
How much data transmission can be saved after IIS compression is enabled? We can perform a simple test. We use Microsoft fiddle, a useful and powerful tool. In principle, it is a proxy that allows the browser to obtain HTTP content. It automatically records the historical access data of the browser. You can download fiddle at http://www.fiddlertool.com/fiddler/version.asp.
First, disable IIS compression, clear the browser cache, and then access the default website homepage of moss 2007 in IE. The access history data recorded in fiddle is as follows:
Request count: 29
Bytes Sent: 11,089
Bytes encoded ed: 676,934
This information indicates that the browser requests a total of 29 Resources, and the server sends a total of K data to the browser. 676 K! This is only the default Moss 2007 site homepage!
Enable the IIS compression function, clear the browser cache, and visit the home page again. The information recorded in fiddle is as follows:
Request count: 29
Bytes Sent: 11,089
Bytes encoded ed: 230,276
We can see that by simply enabling the IIS compression function, the data size requested by the default homepage of moss 2007 is reduced from 676k to 230 K.
From kb blog: http://blog.joycode.com/kaneboy/archive/2007/09/21/108674.aspx
I tested it myself:
Before enabling compression:
Request count: 55
Bytes Sent: 30,254
Bytes encoded ed: 550,563
After compression:
Request count: 55
Bytes Sent: 30,003
Bytes encoded ed: 307,545
The difference between 307 K and K is great.
Benefits of HTTP compression:
Static web pages adopt HTTP compression, which can reduce the transmission volume by about 20%.
The client uses the IE 5.0 browser to connect to a Web server that has enabled HTTP compression IIS 5.0. Today, most modern browsers support compression technology, but the specific compression method depends on the browser. However, you don't need to worry about this because the Web server only sends compressed content when the browser instructs you to support a compression method. However, it makes sense to understand the processing mechanism and the compression types supported by different browsers.
When the browser requests a URL, it submits the supported compression formats to the server through the HTTP header of accept-encoding. IIS or other Web servers read this information from the http_accept_encoding environment variable, this process requires no human intervention. IIS will automatically encode the sent content when the browser supports compression.
The following table lists common browsers and Their supported encoding types:
Encoding supported by the browser
Firefox 1.0, Mozilla 1.x, Camino gzip, deflate
Omniweb 5.x Bzip2, Gzip, deflate
Safari gzip, deflate
Internet Explorer gzip, deflate
Use http compression:
If your site uses a large bandwidth or you want to use the bandwidth more effectively, Please enable HTTP compression. HTTP compression provides a shorter transmission time between the compressed browser and IIS. You can only compress static files, and compress static files and application responses at the same time. If the network bandwidth is limited, HTTP compression is useful (at least for static files) unless the processor utilization is high.
Dynamic processing affects CPU resources. After compression is enabled for a dynamic response, the request is compressed every time it responds dynamically. This means that the dynamic response is not cached. The server may need more CPU cycles to compress and send the response each time the request responds dynamically. Compressed static responses can be cached, so they do not affect CPU resources as dynamic responses do.
How HTTP compression works:
When IIS receives the request, it checks whether the Browser allows compression. IIS then checks the file extension to determine whether the requested file is a static file or contains dynamic content. If the file contains static content, IIS will check whether the file was previously requested and has stored the file in a temporary compression directory in a compressed format. If the file is not stored in a compressed format, IIS will send the uncompressed file to the browser and add the compressed copy of the file to the temporary compressed directory. If the file is stored in a compressed format, IIS will send the compressed file to the browser. Before the first request by the browser, all files are not compressed.
If the file contains dynamic content, IIS compresses this response and sends the compressed response to the browser. Do not store copies of this file.
The compression of a static file usually takes less time because the file is subsequently stored in a temporary compressed directory. The cost of compressing dynamically generated files is higher, because they are not stored and must be regenerated each request. The cost of expanding a file in a browser is very small. The download speed of compressed files is faster, so it is particularly advantageous for improving the performance of all browsers that use limited bandwidth network connections (such as modem connections.
By default, the deadline for compressing files is January 1, 1997, to prevent the proxy server from sending cached compressed file copies to Browsers without compression enabled. This also means that the browser does not display cached copies of files in the Next user request, but returns a new copy of the server request.
Enable HTTP compression:
If the server generates a large amount of dynamic content, consider whether the extra processing cost caused by compression is worth the cost. If % processor time counter has reached or exceeds 80%, HTTP compression is not recommended.
Test HTTP compression:
To create a baseline, use the system monitor to record the value of % processor time counter for the "processor" object in a few days. This counter has a total instance and a separate instance for each processor in the system. (If the server has multiple processors, observe the status of a single processor and the total processor at the same time to find out the imbalance in workload distribution.) In addition, the number of bytes/second counter sent by the "Network Interface" object should also be recorded. Enable compression and continue recording the values of these counters within a period of time, preferably several days, so as to obtain a good basis for comparison. Compare the uncompressed value with the compressed value.
Introduce the subject,
How to Configure Microsoft Internet Information Server 6.0 for HTTP compression:
There are a lot of third-party tools can achieve HTTP compression, but are the need to buy, the price in 100 to 300 US dollars, such as: http://www.port80soft.com/httpzip, if you don't want to spend any extra money to implement this function, you have to work hard for yourself. Let's take a look:
1. First back up the IIS configuration file,
Copy c: \ windows \ system32 \ inetsrv \ metabase. XML to another backup folder.
C: \ windows \ system32 \ inetsrv \ metabase. XML is the core configuration file of IIS. Once the file integrity is damaged, IIS cannot run normally, so it is necessary to reinstall the system.
2. Start the Internet Information Service (IIS) manager in the Start menu, right-click the "website" attribute, open the "service" tab, and check the "HTTP compression" options. Set "temporary directory" and "maximum temporary directory capacity" as needed. After setting, click OK.
3. Right-click "Web Service extension" under "website" and add a new Web Service extension. The extension can be set to "HTTP compression" or other. Add "required files": c: \ windows \ system32 \ inetsrv \ gzip. dll, check "set extension status to allow", and click "OK.
4. the steps below are a bit complex. If you are not sure you can understand them, you 'd better not try them. Right-click the "local computer" attribute of "Internet information service, select "allow directly edit configuration database" and click OK.
5. Run notepad c: \ windows \ system32 \ inetsrv \ metabase. XML in the Start menu to open the metabase. xml file. Make sure that the file has been backed up before any changes.
6. search for and find metabase. hcscriptfileextensions in the <iiscompressionscheme fragment in the XML file, add the file extension you want to perform HTTP Compression Based on the original file format, and add JS and CSS to the static file hcfileextensions; you can add "aspx" "asmx" to the dynamic file hcscriptfileextensions as follows:
<Iiscompressionscheme location = "/lm/w3svc/filters/compression/deflate"
Hccompressiondll = "% WINDIR % \ system32 \ inetsrv \ gzip. dll"
Hccreateflags = "0"
Hcdodynamiccompression = "true"
Hcdoondemandcompression = "true"
Hcdostaticcompression = "false"
Hcdynamiccompressionlevel = "9"
Hcfileextensions = "htm
Html
JS
CSS
TXT"
Hcondemandcomplevel = "10"
Hcpriority = "1"
Hcscriptfileextensions = "ASP
Aspx
Asmx
DLL
EXE"
>
</Iiscompressionscheme>
<Iiscompressionscheme location = "/lm/w3svc/filters/compression/gzip"
Hccompressiondll = "% WINDIR % \ system32 \ inetsrv \ gzip. dll"
Hccreateflags = "1"
Hcdodynamiccompression = "true"
Hcdoondemandcompression = "true"
Hcdostaticcompression = "true"
Hcdynamiccompressionlevel = "9"
Hcfileextensions = "htm
Html
JS
CSS
TXT"
Hcondemandcomplevel = "10"
Hcpriority = "1"
Hcscriptfileextensions = "ASP
Aspx
Asmx
DLL
EXE"
>
</Iiscompressionscheme>
Note that both "compression/deflate" and "compression/gzip" must be modified. Dynamic Compression level. We recommend that you set hcdynamiccompressionlevel to "9"
7. Save and close the metabase. xml file.
8. Restart the IIS service, Run "iisreset", or restart the WWW Service.
9. Others:
If you do not want to enable IIS compression for a web site on your server, run the following script:
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/Site #/root/dostaticcompression false
Cscript c: \ Inetpub \ adminscripts \ adsutil. vbs set w3svc/Site #/root/dodynamiccompression false
To add the file type that enables HTTP compression, run the following script:
"" Is the file extension. Do not forget to add the original extension.
Static File compression:
Cscript. EXE adsutil. vbs set w3svc/filters/compression/gzip/hcfileextensions "htm" "html" "TXT" "Doc" ppt "" xls"
Cscript. EXE adsutil. vbs set w3svc/filters/compression/deflate/hcfileextensions "htm" "html" "TXT" "Doc" ppt "" xls"
Dynamic File compression:
Cscript. EXE adsutil. vbs set w3svc/filters/compression/gzip/hcscriptfileextensions "asp" "aspx" "asmx" DLL "" EXE "" php"
Cscript. EXE adsutil. vbs set w3svc/filters/compression/deflate/hcscriptfileextensions "asp" "aspx" "asmx" DLL "" EXE "" php"
Replace site # With the ID of the web site. What is the web site ID? Go to "logging properties" and check the path before the log file name.
Make sure to back up the above script before running it, and then execute "iisreset" again to make it take effect.
Fiddler2 iis6.0 Compression