The site is 3 times times faster when gzip compression is enabled!

Source: Internet
Author: User

Gzip compression, is a Web site speed optimization technology, is also a SEO optimization tool, many websites have adopted this technology, in order to improve the speed of Web page opening, shorten the opening time of the Web page.

This article is a research article, will be a case to show you the site using gzip compression before and after the contrast effect.

The object to be studied here is the Garden blog http://www.yzznl.cn/, which has been using gzip compression technology. You can perform gzip compression detection here.

The experiment that follows is a comparison of the speed and time at which the Web site is opened with and without gzip compression.

The selected test tool is Webkaka website velocimetry tool, Webkaka old users please note that Webkaka website Velocimetry has been added to the site is the decision to enable gzip compression. You can use GZIP compression to open Web pages and do not use gzip compression to open Web pages in two ways to test Web page opening speed.

One, do not use gzip compression to open Web pages

The first thing to test is to open the Web page directly without gzip compression. Tachometer Address: http://www.webkaka.com/webCheck_v3.aspx

The test results are as follows

As you can see, the page size is 50275 bytes, without gzip compression, the average open time is 5.128 seconds, and the satisfaction score is only 59 points (what is the satisfaction score?). )。

II. using gzip compression to open Web pages

The test now is to open the Web page with gzip compression. Tachometer Address: http://www.webkaka.com/webCheck.aspx

The test results are as follows

As you can see, the page size is 12187 bytes, which is the volume after gzip compression. The average open time is 1.82 seconds, and the opening time is shortened by 2/3 compared to not using gzip. And the satisfaction score reached 91 points high.

Summary

By comparing the above two sets of data, the effect of gzip compression optimization is very obvious. Because of its effectiveness, most websites use this technology for speed optimization. If your website is not fast enough and you are not using this optimization technology, then hurry up and use gzip compression to get your site up to 3 times times faster!

In fact, the site uses gzip compression, there is a benefit, is to let you less than a traffic exceeding the worry. Since Gzip is turned on, the data that is exported to the user's browser is compressed, which reduces the amount of data transmitted over the network, and that is why the page is being opened.

Related Knowledge

How to enable the Gzip compression feature for IIS

First, if you need to compress the static file (HTML), you need to build a directory on the hard disk and give it the write permission of the user "IUSR_ machine name". If the compressed dynamic file (php,asp,aspx) is not needed, because its pages are dynamically generated each time, the compression is discarded.

Then in IIS Manager, the "Web site" right-click Property, not one of the following sites, but the entire site. Go to the "Services" tab, select Enable dynamic content compression, static content compression. Then select the server extension below the site to create a new server extension. The name does not matter, the following path to add the file is: C:\windows\system32\inetsrv\gzip.dll, and then enable this extension.

Static content can be compressed at this time, but for dynamic content, the ASPX file is not in the compressed range. Because the default compressible file does not have this extension. And in the management interface you can not find a place to add extensions, this time only to modify its configuration file. Under the c:\windows\system32\inetsrv\ there is a MetaBase.xml file, you can open it with Notepad, find IIsCompressionScheme, there are three identical names of the segment, is Deflate,gzip, Parameters, the third paragraph does not need to control it, the first two paragraphs have the same parameters, in the two paragraphs of the parameters hcscriptfileextensions below all add a line of ASPX, if you have other dynamic program to compress, also add here. HcDynamicCompressionLevel changed to 9, (0-10,9 is the most cost-effective one).

Finally, be aware that you should not forget to restart the IIS service.

nginx Configuration gzip compression

By default, Nginx gzip compression is off, and only for text/html compression, need to edit the nginx.conf file, add a configuration in the HTTP segment, the common configuration fragment is as follows:

gzip on;
Gzip_comp_level 6; # compression ratio, the larger the ratio, the longer the compression time. Default is 1
Gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml; # which files can be compressed
Gzip_disable "MSIE [1-6]\."; # IE6 Invalid

enable the Gzip feature for Apache2

APACHE2 official in the development of the time, has already put the page compression into account, built the Mod_deflate module, so apache2 do not need to use to Mod_gzip, the two work principle is similar, there are mod_deflate this page compression module, function and efficiency and mod_gzip is similar, even fortunately some, there is no need to use the Mod_gzip module.

Configuration file instance:

<ifmodule mod_deflate.c>
Deflatecompressionlevel 9
Addoutputfilterbytype DEFLATE text/html text/plain text/xml application/x-httpd-php
Addoutputfilter DEFLATE js CSS
</ifmodule>

LIGHTTPD Configuring gzip

Configuring Gzip is primarily using the Compress module
1. Activate the Compress module and remove the comments from the mod_compress of the lightppd.conf file
2. Configure compressed files to store directory Compress.cache-dir, note that users running LIGHTTPD need to have read and write permissions for this directory, and the type of compressed files Compress.filetype
3. Dynamically generated PHP also gzip, modify php.ini, plus zlib.output_compression = on and Zlib.output_handler = On
4. Restart LIGHTTPD

Configuration file instance:

Compress.cache-dir = "/home/flymouse/lighttpd/compress/"
Compress.filetype = ("Text/plain", "text/html", "Application/x-javascript", "Text/css", "Application/javascript", " Text/javascript ")

The site is 3 times times faster when gzip compression is enabled!

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.