Web compression and deflate the difference --gzip

When we configure the Web site GZip compression, you will find two modules can be set, a parameter configuration module GZip, Deflate the other is a parameter configuration module, whose setting method is the same. At first I do not understand, what is the difference of these two places? To set up the site open GZip GZip compression module or modules Deflate? Today, by reference to the relevant information, we see few differences between them.

gzip and deflate

HTTP defines a mechanism, a Web client and Web server agree to a compression scheme can be used to send content. This is done using the Accept-Encoding and Content-Encoding header to complete. There are two common HTTP Compression: DEFLATE and GZIP.

DEFLATE compression algorithm is a patent-free, it can achieve lossless data compression, there are many open-source algorithm.

Another GZIP compression using the DEFLATE data compression library.

Several differences between gzip and deflate (in Apache server as an example)

The following are some users comments:

Apache server to open the site by GZip compression and mod_gzip mod_deflate both places, regardless mod_gzip or mod_deflate, the information returned here are the same. Gzip compression because the way they are implemented. Here mainly to talk about a few differences between them.

First, Apache Web server version differences

Apache 1.x series no built-in web compression technology, so before going to perform compression with additional third-party mod_gzip module. The Apache 2.x official development at the time, took into account web page compression, built mod_deflate this module to replace mod_gzip. Although both are Gzip compression algorithm used, their principle of operation is similar.

Second, compression quality

mod_deflate mod_gzip compressed slightly faster and slightly higher compression ratio. In general default, mod_gzip will be more than 4% to 6% of the compression ratio mod_deflate.

Third, the occupation of server resources

In general mod_gzip occupation of the server CPU to be higher. mod_deflate a compression module is dedicated to ensure server performance and use, mod_deflate require fewer resources to compress files. This means that in high-traffic server, use mod_deflate may be faster than mod_gzip loading speed.

In short, if your site, less than 1,000 unique visitors a day, you want pages load faster, you use mod_gzip. Although it will take some additional server resources, but it is worth it. If your site is more than 1000 unique visitors per day, and are using shared web hosting, the allocation of limited system resources, use mod_deflate would be a better choice.

How to set up virtual space GZip

Gzip is not enabled for two or more modules of the virtual space, you can also use the next best thing in php zlib library (also need to see whether the server supports) to compress files, but this method is too much trouble, and generally more time-consuming server resource, according to the situation with caution.

Editor: Deflate simply an outdated web page compression should be disabled

Xiao Bian today checked the data and found that some of the above comments are inappropriate, according to information on the relevant GZip and Deflate and Deflate compression is just an outdated web page, the browser now their support is not good, you should disable the deflate compression. Please take a look at small series translated Bowen "deflate-- outdated web page compression format."

ps: article reprinted from http://www.webkaka.com/tutorial/server/2015/021013/

Guess you like

Origin www.cnblogs.com/Jeely/p/10977864.html