Mobile app version of vmapp.org
Login or Join
Sent6035632

: Should I use gzip for compressing my HTML? I saw from an online tester that my HTML can be compressed about 90%! Is it good practice to use gzip or not? I see that lot sites don't use

@Sent6035632

Posted in: #Compression #Gzip #PageSize #Performance

I saw from an online tester that my HTML can be compressed about 90%! Is it good practice to use gzip or not? I see that lot sites don't use it.

For me it would improve traffic, as some pages contain a lot of data (120 KB of HTML without the images) which can be compressed to a few kilobytes.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

3 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

Is it good practice to use gzip or
not?


Depends upon your webserver's environment.

If your server is running low on idle CPU time, adding GZIP deflation could actually slow down the rate at which your server responds to requests.

If you're not presently dealing with a CPU bottleneck, however, GZIP deflation is a great idea but only for plain-text files.

Most image file formats (i.e. PNG, JPG, GIF) are already compressed and GZIP deflation is a waste of CPU time.

10% popularity Vote Up Vote Down


 

@Jamie184

Yes. 120KB for HTML alone(!) can be compressed greatly. Together with the CSS and JavaScript files. This will speed up the browsing experience for your users and save you bandwidth on your server.

You could implement the compression using your server-side script and cache the compressed files, thus easing the pressure on the CPU on busy servers.

10% popularity Vote Up Vote Down


 

@Voss4911412

Yes, there is almost no reason I can think of to not use GZIP at all times. It's like getting free bandwidth, and it is universally supported. Always have it on!

The only possible downsides are


If you are on a shared host with very limited CPU resources, as the compression is done on the server and it does take a tiny bit of server CPU. The server would have to be very overloaded and/or extremely old for this to matter in practice, though.
If you serve up very large (and by large I mean 400 kilobytes and up) dynamic web pages. Compressing very large dynamic content on the fly can be prohibitively expensive.


But these are both rare edge conditions in my experience; 99% of the time HTTP compression is a clear win.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme