Brotli is a new compression standard which was introduced by Google to replace the aging GZIP format.

It’s been out for a while now and I’ve never gotten around to setting this up on my server. Until today, this site’s now being served using Brotli compression if your client supports it!


The support for Brotli is quite good, most modern browsers support it. The most notable exception is of course the aging Internet Explorer browsers.
I tend to care less and less about these monstrosities of the past. Since things are setup to degrade gracefully, people will still be able to use these older clients, but just miss out on optimizations that modern browsers provide.

What about performance?

Running a quick test, I found quite a significant reduction using Brotli on my homepage. Without Brotli, the total size of the homepage is about 577KB. With Brotli this is reduced to 390KB which is about 67.5% of the original total size. That’s definitely worth it.

This reduction in size comes at a cost though. Brotli tends to be a bit heavier on the CPU than the older GZIP format is. So that has to be taken into consideration when you want to implement it yourself. For my humble little site/server this is not much of a problem since the CPU’s idling most of the time anyways.
Adjusting the compression level of Brotli can make the CPU bound performance better, at the cost of bigger file sizes. As usual there’s no silver or golden bullets, you will have to experiment yourself to get the best setup for your situation.

Credits where credits are due

The latest Ubuntu LTS (18.04.2) doesn’t have Brotli support baked in. You will have to compile the Brotli module yourself.
Here you can find an effective guide on how to do this for Apache. Just beware that the makefile requires you to also have the “apache-dev” package installed. This can be obtained from Ubuntu’s default repositories.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *