Cover image for How to optimize your website(feat.brotli Compression)

How to optimize your website(feat.brotli Compression)

ham8821 profile image Emma Ham Originally published at dev.to ・3 min read

Hi everyone!
Last time, I talked about Gzip compression which is one of the most common way to encode content, and someone have mentioned about brotli by Google.
For that reason, today I would to talk little bit about brotli.
If you haven't read my last post about Gzip compression, please Jump on here!

Alt Text

Alright, like mentioned above, Gzip is one of the popular and common ways of content encoding yet very useful in terms of the fact that it is easy to use because it can be executed simply by adjusting the setting provided by web server.
However, at the same time it is getting critics because it is not perfect when it comes to security problems.

FIRST: Birth of Brotli

In September 2015, Google released the Brotli as a open source and then it started getting popular as chrome started supporting brotli compression.

Alt Text

SECOND: Gzip VS Brotli

I know, You must be curious about which one is the best and I know always there would some discussions and different opinions on this.
But, according the this article which is comparing some of the compression technology including gzip and brotli,
less means better
Alt Text

Alt Text

It is concluded that in terms of ratio of compression, brotli is showing the best result, yet in the compression speed area, gzip is showing the better result.

If you want to have a look at more articles on this, the links below might help you to understand more.


THIRD: Using Brotli on Nginx

Obviously, nginx is one of the web servers that has so many benefits. However, when we use brotli, it might require bit of an extra work.
If nginx version has been changed, we need to accordingly compile and reset the setting which sounds quite annoying at this point.
In order to reduce the extra work, there are some ways to automate these steps on internet yet it is not perfect.

Here are some links about Brotli support
1) https://github.com/pothi/nginx-brotli

2) Brotli with Engintron Nginx

LAST: Conclusion

Alt Text

To sum up, Brotil is probably the best way to execute the content encoding comparing to previous deflate or gzip when we consider the fact that it definitely increases the ratio of compression and obviously reduces the loading time at maximum 20%. However, there are still some discussions about whether it is also better way for dynamic contents websites not only for static websites. Also, we need to keep an eye on the fact that it might be high-maintenance in some ways.

Posted on Sep 4 '19 by:

ham8821 profile

Emma Ham


Not so sure what I am supposed to write here, but sometimes we don't need to know everything, do we:)


markdown guide