Gajus
Gajus

Reputation: 73818

Is there any content that I shouldn't gzip?

The Facebook app I am running is on app.[domain] domain. All the static content is stored in /public path. However, the content is being loaded through a cookie-less alias domain static.[domain] host.

Given the present design, it is easy for me to create a copy of all static files, gzip them and use explicitly for serving through static.[domain] host.

However, should I exclude any type of file from being gziped? (apart from already gziped content ...)

Upvotes: 2

Views: 1121

Answers (2)

Michał Kosmulski
Michał Kosmulski

Reputation: 10020

Usually, it is a waste of resources to compress data which is already well compressed. Compressing for a second time will gain little to no size difference (or even a slight growth of data in extreme cases), but will cost you and your users extra CPU time for first compressing the data and then decompressing it.

In practice this means you should avoid compressing: most web image formats (JPG, PNG, GIF), almost all A/V multimedia (audio: MP3, OGG, FLAC; video: MPG, MP4, AVI, etc.), and of course common archive formats (ZIP, GZIP, BZ2, RAR, 7ZIP, ARJ, etc.). Also, OpenDocument (.ODF etc.) and new MS Offices files (.DOCX etc.) as well as Java JAR files are internally ZIP archives, so they need no compression, either. SOme PDFs are internally compressed while others are not. Compressing very small files (less than a hundred bytes or so) may also be ineffective depending on the contents.

You could also go in the opposite direction and only explicitly list file types that should be compressed, leaving others without compression. What certainly compresses well is text files: plain text (TXT), HTML, CSS stylesheets, JavaScript (JS) files.

Upvotes: 2

Victor Sorokin
Victor Sorokin

Reputation: 12006

well, any format which already archived in one way or another, like jpg, mp3, so on.

Upvotes: 0

Related Questions