This article explains what the Brotli Compression Algorithm is and how it can benefit your website. We also compare it to Gzip and list all the InMotion Hosting servers it is available on.
- Website Compression
- What is Brotli Compression
- Brotli vs Gzip
- Does InMotion Use Brotli?
- Upcoming Articles
All of the content of your website must be transferred to the visitor’s browser before it can be displayed. If the files are compressed before being sent it can make the transfer smaller but uses your server’s resources. For example, the more you compress data the faster it can be transferred, but it can slow your server down if it is constantly processing the compression. This requires a delicate balance of compression using server resources; and transfer speed with bandwidth usage. Many of you are familiar with gzip, which handled most server compression until recently. While gzip does a good job of compressing data, there is always room for improvement. This leads us to the Brotli Compression Algorithm.
What is Brotli Compression?
In 2015 Google introduced a new open-source compression algorithm called Brotli. This new algorithm promises better compression while using fewer resources. Compressing the responses being sent from NGINX to your browser is a great way to optimize your website. This can specifically help reduce your time to first byte. While it is not compatible with all browsers at this time, it does already work with the major ones such as Chrome, FireFox, and Edge. Brotli is also supported by popular content delivery networks (CDN) like Cloudflare and Sucuri.
How Does your Browser handle the Data?
If you visit a website, your browser sends a list to the server of the encoding options it will accept. This is included in the Accepts-Encoding header. The server then:
- Takes the list of encoding options
- Determine which ones it has available
- Compress the data using Brotli or gzip
- Sends it back to the browser with the Content-Encoding so the browser knows how to decode the data.
Brotli vs Gzip
We performed some tests on a WordPress site so we could compare the compression rates. First, we visited specific pages or files on our WordPress site with gzip enabled. Then, we reviewed the compression rates via the cPanel access log. Next, we deployed Brotli on the same server and tested the same pages and files. Finally, we reviewed and compared the results, here is a table:
|WordPress Page||Gzip Compression Rates||Brotli Compression Rates|
Here you can see that we got better compression rates with Brotli deployed than with gzip. I do not have any detailed information, but my System Administrator confirmed there was no noticeable difference in CPU usage. This confirms Google’s promise of better compression rates.
Does InMotion Use Brotli?
Now that you know what Brotli is, you may be wondering… does InMotion Hosting utilize the Brotli Compression Algorithm on their servers? Since we now offer a variety of hosting plans, It depends on which one you sign up for. The following plans include Brotli compression already:
Since you can get root access to some servers, you can install Brotli yourself on the following: