KeyCDN Launches Brotli Support

brotli

At KeyCDN , we’re happy to announce that the next generation of file compression support is here! That’s right, as of today (February 16, 2017) the option to enable Brotli support has been rolled out to all KeyCDN customers at no extra cost.

For users who want to further compress their files in order to deliver content even faster, Brotli will enable you to do just that. You’ll notice that in the KeyCDN dashboard under the advanced settings section of your zone, there is now a new option called Cache Brotli.

enable keycdn brotli feature

This feature is disabled by default, however in this post, we’ll cover what you need to know about how KeyCDN supports the new Brotli feature and how you can start taking advantage of its benefits.

What Is Brotli?

Brotli is a new compression algorithm that was developed by Google in order to help further reduce the size of files. This means less bandwidth is used to transfer files that take advantage of Brotli compression and visitors accessing these files receive them faster. Many studies such as Google’s Compression Algorithm Study have shown impressive compression results using Brotli. A 20-26% higher compression ratio has been seen when comparing Brotli to Zopfli (another modern compression algorithm).

Sam Saffron, co-founder of Discourse, also ran a few tests and gathered some impressive results of his own. The chart below shows a comparison in size savings using various compression algorithms against 8 different assets.

brotli size savings

Source: Samsaffron

As we can see, when compared to the other compression algorithms (Gzip and Zopfli) brotli_11 always comes out ahead and brotli_5 is better in most cases as well. The numbers beside each compression algorithm (e.g. gzip_5 and brotli_5) refer to the level of compression. The higher the number, the greater the file size savings. However, the tradeoff to this is that the higher the compression level, the more resources are required to compress/decompress a file.

A few highlights and important facts about Brotli you as a user should be aware of include:

  • Brotli offers a comparable compression ratio offered by the best compression methods and uses less CPU. Additionally, it is considerably better than Gzip.
  • Both the server and browser must be Brotli compatible to take advantage of this compression method (more on browser and web server support below).
  • Browsers will not accept Brotli encoding over HTTP connections, only HTTPS.

How Does KeyCDN’s Brotli Support Work?

At KeyCDN, we always have performance at top of mind. Therefore, we’ve introduced Brotli support in a way that ensures your files are delivered using the Brotli encoding without sacrificing time waiting for the Brotli compression to take place on the CDN level. This is the difference between on-the-fly Brotli compression and Brotli compression that’s introduced at the origin server level.

To use KeyCDN’s Brotli compression feature, your origin server must first support Brotli. This allows for your files to be compressed using the Brotli algorithm on your origin server which therefore allows the edge server to cache and deliver the Brotli compressed files. Using this method, you also have the flexibility to define whichever Brotli compression level you want (a good starting pointing is Brotli 4). To check if your origin server currently supports Brotli, use our Brotli test tool.

Once you’ve verified that your origin server supports Brotli and that you have the Brotli feature enabled in the advanced settings of your zone, you’ll be able to start delivering Brotli compressed assets to compatible browsers through KeyCDN. Take the following example which we’ve setup using the Brotli-enabled origin server of our KeyCDN tools page.

brotli accept encoding

Requesting an asset from this page using the CDN URL will add the value: br to the accept-encoding Request Header. Furthermore, you’ll also notice that the content-encoding Response Header will return the Brotli value: br.

brotli content encoding

Brotli Browser Support

Brotli browser support has certainly improved (and continues to improve) even in just a matter of months. At the beginner of 2016, the only major browser that supported Brotli was Firefox. Now, other browsers such as Chrome, Opera, and Edge have jumped on board to also support the delivery of Brotli compressed assets.

brotli browser support

As mentioned above, if you have the KeyCDN Brotli feature enabled, however a visitor that isn’t using a supported web browser requests an asset, they will be delivered that asset either Gzipped or uncompressed depending on the compression settings defined.

Brotli Web Server Support

Similar to browser support, web servers continue to build upon supporting Brotli compression. Depending upon which web server you’re using, you will need to use a dedicated implementation method. The following resources should help steer you in the right direction based on your web server.

  • Nginx has a Brotli extension offered by Google requiring you to compile Nginx by yourself in order to use it.
  • Apache offers a dedicated Brotli extension.
  • Microsoft IIS doesn’t offer any official Brotli support, however there is a community module that adds support.
  • Node.js is similar to Microsoft in that there is no official support for Brotli however there exists a community module.

Summary

KeyCDN is proud to be amongst one of the first CDN providers to offer Brotli support. Fun fact about Brotli: it is named after the Swiss bakery product – Brötli, which is commonly referred to as “small bread”. Only fitting that KeyCDN is a Swiss company ;).

We know that speed is extremely important to our customer so providing the ability to compress web files even smaller will help further improve web performance. Be sure to check our KeyCDN community page to participate in further discussions revolving around web performance, CDN features, and more!

We would love to hear your feedback! If you have any questions regarding this new feature feel free to comment below.

KeyCDN Launches Brotli Support was last modified: February 16th, 2017 by Cody Arsenault
  • Really great news. Have neen using Brotli on my origin server for quite long time and now I can use it over CDN too. Really good job guys. Just one minor heads up, I’m still unable to joing KeyCDN community page, will someone please take a look into it?

  • Ronald de Bruijne
  • Hi. I have a few questions. I will be thankful if you can reply.

    Is there any reason to support brotly only when the origin server supports it too? Brotly (5) is almost equal to gzip in terms of CPU load.

    Does keyCDN gracefully fallback to gzip, deflate or no-compression in the relevant scenarios?

    Thanks.

  • Anyone there?

  • “a visitor that isn’t using a supported web browser requests an asset,
    they will be delivered that asset either Gzipped or uncompressed
    depending on the compression settings defined.”

    Can you please explain, for that user with browser that does not support brotli, would KeyCDN send request to origin server for uncompressed/gzipped resource? Or shall it decompress the asset and send it gzipped (or without any content encoding) on its own?

    I am asking this question because I want to attach DigitalOcean’s Object Storage as an origin server. They support custom Content-Encoding header per file basis. I am planning to pre-compress the assets using brotli and then specify brotli Content-Encoding. In this setup, its not possible to serve any gzipped or raw asset.

    An early response would be appreciated.
    Thanks.

    • In the case that a browser does not support Brotli, KeyCDN will send a request to the origin server for the uncompressed/gzipped asset. We do not decompress the Brotli asset on our side.

Share This