Who wants to bake smaller rolls? - All WordPress professionals who want to deliver their website as fast as possible. For some time now, a technology called Brotli has been very popular.
Currently, there are several compression methods. For a long time gzip was the standard, but in the meantime a new compression algorithm called Brotli has taken over. And not without reason! To keep your WordPress website up to date 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 technique that reduces the storage space of data as much as possible. This is because the smaller the volume consumed, the shorter the transfer 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, which consists of a combination of the LZ77 technique and the Huffman coding. Deflate has been around since 1993 and has since become the absolute standard for HTTP transfers.
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.
That was probably still not enough, because in the meantime there are Brotli - named after Brötli, Swiss rolls.
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.
- 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.
Brotli offers advantages especially for mobile websites
Mobile devices and data tariffs in particular benefit from compression. Here, the available bandwidth is often much lower, so that even a 20 percent saving results in a significantly better user experience. Web servers and devices may be quite fast by now - it's just that the Internet is not always.
As more and more people access websites on the go and therefore benefit from the smaller size of Brotli files (for example, through reduced battery usage and lower transmission fees), Google hopes that the algorithm will become the new standard in the future.
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
However, file size savings are not the only benchmark against which a compression method must be measured. After all, you want to improve the performance of your website. The speed with which information is compressed and decompressed is also an important aspect. After all, this is what determines how quickly you see results.
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, that's the standard these days anyway.
"*" indicates required fields
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 the matter when compressing dynamic content: As long as the server is busy compressing the content, you don't see anything. Only when the compression is complete is the data delivered. And the better the compression is supposed to be, the longer it takes. Even at low compression rates, dynamic compression can already limit performance. Static content, on the other hand, which is already compressed, can be delivered in no time at all when a request is made.
In practice, it turned out that Brotli is more useful for static content if the algorithm is configured accordingly. For dynamic content, however, many still prefer gzip. Others argue that Brotli can keep up with gzip even for dynamic content.
Not all browsers support Brotli
As for servers, NGINX and Apache (from version 2.5) support Brotli. Nowadays almost all browsers support Brotli. Which browsers do not (yet) support Brotli as a compression standard can be found at caniuse.com.
If you still have to do without Brotli because of certain browsers, there is good news: The content will still be delivered to these users: In this case gzip will be activated automatically. So you don't have to fear that they won't see anything at all.
Saving storage space, delivering websites faster, and boosting performance: we're happy to go along with that. In my opinion, the advantages are obvious. At Raidboxes, you benefit directly: Brotli is built into the servers as standard.