Why Google's Brotli Compression Algorithm is a Real gzip Alternative

Tobias Schüring Last updated 05.11.2020
5 Min.
Last updated 05.11.2020

All WordPress professionals want to deliver their website as quickly as possible. For some time now, a technology called Brotli has been in high demand. In this article, I'll explain how it makes your website faster and what it has to do with Switzerland.

Currently there are different compression methods. For a long time gzip was the standard for a long time but now a new compression algorithm called Brotli is outstripping it. And not without reason! To make sure that your WordPress website keeps up with the times in terms of compression, Brotli has become the standard at RAIDBOXES. But let's start from the beginning.

Data compression 101

Data compression is a method of reducing the storage space of data as much as possible. Because: the lower the space consumed, the shorter the transmission time.

Data is summarized or compressed to achieve this reduction. In principle, the information is converted into a shorter form that requires less storage space.

Compression and decompression are two processes, but it’s ultimately still faster than simply transferring large amounts of data.

Google as a Brotli baker

The previous compression standard on the internet was gzip. This compression works with an algorithm called Deflate, a combination of the LZ77 algorithm and Huffman coding. Deflate has been around since 1993 and has become the absolute standard for HTTP transmissions.

But that was not enough for Google. In the Silicon Valley giant's constant efforts to improve the internet, it developed the algorithm Zopfli (named after the Swiss sweet bread Hefezopf) several years ago. Zopfli uses a similar technique as Deflate, is compatible with its data format, and already has some benefits over the existing algorithm.

This still wasn’t enough for the Google technicians who developed Brotli. Sticking with the Alpine theme, this algorithm is named after the Swiss name for rolls, Brötli.

Brotli is an open source algorithm which, according to Google, represents a completely new data format. Although it's not compatible with Deflate, Brotli has several other advantages.

Gzip vs. Brotli: who’ll win the race?

So how much of a savings does Brotli provide over the standard gzip process? Reports show a clear advantage:

  • With HTML Brotli saves 21% more space than gzip.
  • With JavaScript it's 14%.
  • CSS is stored 17% smaller by Brotli than by gzip.

In principle, the difference in speed between the transmission of compressed and uncompressed data is already quite large. Gzip saves a fair amount of memory compared to the starting point. Brotli goes one further, even if the figures compared to gzip don’t look like massive savings at first.

Mobile sites benefit from Brotli 

Mobile devices and data tariffs especially benefit from compression. Here, the available bandwidth is often much lower so a saving of just 20% can result in a much better user experience. While web servers and devices are fairly fast nowadays, the same can’t always be said about the internet.

As more and more users access websites on the go, Google hopes the algorithm will become the new standard in the future. Users benefit from the smaller size of Brotli files - from reduced battery consumption to lower data usage.

Limitations of Brotli

Despite these advantages, Brotli is not an all-rounder. Google introduced the algorithm in September 2015. It's still in its infancy and there are still one or two limitations you’ll just need to accept for now.

Accurate configuration is important

File size savings are not the only yardstick against which a compression method should be measured. In the end, you also want to improve the performance of your website. The speed with which information is compressed and decompressed is an important aspect. How quickly your website visitors get to see results depends on it.

A wrong configuration between memory saving and speed of conversion can cause gzip to be even faster than Brotli. Both gzip and Brotli have several quality levels (gzip has nine and Brotli eleven).

So it's a matter of fine tuning what you want to get out of your configuration. Test results show that Brotli at level 4 saves more memory and works even slightly faster than gzip at level 6.

Brotli only works on HTTPS

Brotli only works with HTTPS connections. But honestly: Since Google has officially announced that the use of HTTPS is a ranking signal, you should switch to SSL very soon anyway. Especially since HTTP2 provides an additional performance boost. This is only one of many reasons why we at RAIDBOXES offer free SSL with one click by default from the very beginning.

Brotli is perfect for static content

Another often discussed sticking point is the compression of dynamic content. A quick refresher:

  • Dynamic content is only generated individually with a request, e.g. if you only want to see the entries of certain categories in a blog or if you select shirts from a certain brand in a certain size in an online shop using the filter function. Of course, the content is not compressed until it’s been generated.
  • Static content, on the other hand, is already compressed on the server and is delivered to all users in the same way.

The crux of compressing dynamic content: as long as the server is busy compressing the content, it’s not visible for the user. The data is only delivered when the compression is complete and the better the compression, the longer it takes. Even at low compression rates, dynamic compression can limit performance. In contrast, static content, which is already compressed, can be delivered in no time at all when a user requests it.

In practice, it became apparent that Brotli is more effective for static content if the algorithm is configured accordingly. For dynamic content, however, many website operators still prefer gzip. Others argue that Brotli can also keep up with gzip for dynamic content.

Not all browsers support Brotli

As far as servers are concerned, NGINX and Apache (from version 2.5) support Brotli. However, not all browsers support Brotli yet. You can find out which browsers support Brotli as a compression standard at caniuse.com.

Why Google's Compression Algorithm "Brotli" is a Real Alternative to GZIP
Source: https://caniuse.com/brotli

Internet Explorer users, for example, have to do without Brotli at the moment. But the good news is the content will still be delivered to these users: gzip switches on automatically. So you don't have to worry that your visitors won't be able to see anything at all!

Since at least in Germany with Chrome and Firefox more than 70 percent of the market is already covered, you can assume anyway that a large part of your website visitors can already benefit from Brotli.

Final thoughts

Saving storage space, delivering websites faster and increasing performance: that's what we all want. In my opinion, the advantages of Brotli are clear. RAIDBOXES customers are already benefitting from Brotli as it's built into our servers as standard.

As a system administrator, Tobias watches over our infrastructure and finds every possible way to optimize the performance of our servers. His tireless efforts mean he can often be found on Slack in the early hours.

Comments on this article

Post a comment

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