Hello guys, this time i wanna share about BROTLI. What is brotli?, Why Brotli?, Comparison and how to build the packages. Let's begin with what brotli is.
BROTLI is a new compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm + Huffman algorithms.
BROTLI is a new compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm + Huffman algorithms.
LZ77 overview
:
abcdeabcdf can be
compressed with LZ77 to abcde<4,5>f and aaaaaaaaaa can be
compressed to simply a<9, 1>.
Huffman : Bit
Conversion. I will not discuss this in depth but if you want to, take a look on this brotli-ietf.
Developed by Google.
Developed by Google.
Why Brotli?
The smaller compressed size allows
for better space
utilization and faster page loads.
As the
smaller compressed size would give additional benefits to mobile users, such as
lower data transfer fees and
reduced battery use. Compressed
content takes less
time to transfer and reduces load times.
Brotli comes with 0 to 9 levels of compression.
Brotli comes with 0 to 9 levels of compression.
Comparison with others?
Browser Support?
Brotli compression not yet supported by all varian of web browser, so make sure you have a "PLAN B" compression such as gzip.
Build the package?
Default nginx package not include brotli module, so we must add brotli module manually and rebuild the nginx package. Even there is bortli-included nginx package on the web (not official), it's recommended to build it yourself in concern of security. So, follow this step
I'm using Centos 7 when i build the package.
- Install the prerequisite package
- Download nginx package using wget. Pull ngx_brotli module using git and update the module.
- Before we configure nginx, add nginx user and temporary folder
- Decompress nginx package and configure nginx to include the ngx_brotli module. After that make the installment.
- Decompress nginx package and configure nginx to include the ngx_brotli module. After that make the installment.
- Check nginx version
- Next, we need to make nginx systemd service
- Run nginx service to make sure it's running and enable it
- Configure nginx.conf file to enable brotli module, in my case i enabled the gzip algorithm too, because in case the browser not support with brotli it will redirect the algorithm to gzip.
- Configure nginx.conf file to enable brotli module, in my case i enabled the gzip algorithm too, because in case the browser not support with brotli it will redirect the algorithm to gzip.
- And then restart nginx
Result ?
This is the result sample when brotli compression implemented with nginx server.
This is the result sample when brotli compression implemented with nginx server.
Happy Brotling !!!
Referensi :
- https://www.enovate.co.uk/blog/2017/02/28/how-to-brotli-compression-with-nginx
- https://certsimple.com/blog/nginx-brotli
- https://sekolahlinux.com/implementasi-nginx-libressl-http2-brotli-pada-centos-7
No comments:
Post a Comment