Picture to enable gzip compression (Absolutely not) _ server other

Source: Internet
Author: User

Often someone in the group asked, the picture really need to enable gzip compression? I answered more than once that the picture is not required to enable gzip compression. Today, I write this issue, to analyze why the picture does not need to enable gzip compression.

Picture enabling gzip compression can backfire

Some developers use HTTP to compress files that have already been compressed locally, and those files that have been compressed are not able to perform high-performance when they are compressed again by gzip, as shown in the following two areas.

First, HTTP compression requires cost. The Web server gets what it needs, then compresses it, and finally sends it to the client. If the content can't be further compressed, you're just wasting the CPU doing meaningless tasks.

Secondly, the use of HTTP compression has been compressed things do not make it smaller. In fact, adding headers, compressing the dictionary, and verifying the response body actually makes it larger, as shown in the following illustration:

HTTP Compression process

Does your site actually do this? Yes, it's more common than you think.

The consequences of enabling gzip compression for PNG pictures

The following is a PNG image with gzip compression enabled to see its header information:

The consequences of enabling gzip compression for PNG pictures

Not only waste the CPU, but also increase the volume of the picture, before also wrote a detailed analysis of the "Picture gzip compressed volume after the larger", here to see the picture is the consequences of gzip compression:

Gzip Pictures Increase the volume

In a word to conclude that is the picture enable gzip compression, not only waste the CPU, but also increase the volume, will affect the performance of the server, affecting the speed of the site. Do you want to enable gzip compression for the picture? Absolutely not!

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.