Http://www.ibm.com/developerworks/cn/web/wa-lo-webcompress/index.html
Web page compression is a protocol that is shared by web servers and browsers. That is to say, web servers and browsers must support this technology. Fortunately, the popular browsers currently support this technology, including IE, Firefox, and opera. servers include Apache and IIS. The negotiation process is as follows:
- First, the browser requests a URL address and sets the attribute accept-encoding value to gzip, deflate in the request header, indicates that the browser supports gzip and deflate compression methods (in fact, deflate also uses the gzip compression protocol. The difference between the two is described below );
- After receiving the request, the web server determines whether the browser supports compression. If yes, the compressed response content is transmitted; otherwise, the uncompressed content is transmitted;
- After obtaining the response content, the browser determines whether the content is compressed. If yes, It decompress the content and then displays the content on the response page.
In practical applications, we found that the compression ratio is usually 3 to 10 times, that is, the page with a size of 50 kb, after compression, the actual size of the transmitted content is only 5 to 15 kb, which can greatly save the network bandwidth of the server.ProgramWhen the response is fast enough, the speed bottleneck of the website is switched to the network transmission speed. Therefore, after the content is compressed, the page browsing speed can be greatly improved.