Brotli is a new data format that can provide a compression ratio 20-26% higher than Zopfli. What is Brotli Compression Algorithm? Brotli was originally released in 2015 for offline compression of web fonts. Google software engineers released an enhanced version of Brotli in September 2015 that includes general lossless data compression, with a particular focus on HTTP compression. The encoder has been partially rewritten to improve compression ratios, both encoders and decoders have been made faster, and the streaming API has been improved to add more compression quality levels. The new version also shows performance improvements across platforms, as well as reducing the memory required for decoding. Unlike common general-purpose compression algorithms, Brotli uses a predefined 120-kilobyte dictionary. The dictionary contains over 13,000 common words, phrases, and other substrings drawn from a large corpus of text and HTML documents. Predefined algorithms can improve compression density for smaller files. Using brotli instead of deflate to compress text files can usually increase the compression density by 20%, while the compression and decompression speed remains roughly the same. A content encoding type of "br" has been proposed for streaming compression using Brotli. Install 1. Download brotli git clone https://github.com/google/ngx_brotli cd ngx_brotli && git submodule update --init 2. Compile Add –add-module=/opt/nginx/ngx_brotli after the original compilation configuration For example Copy the code as follows: ./configure --prefix=/usr/local/nginx --user=www --group=www --with-pcre=/opt/nginx/pcre-8.41 --with-http_ssl_module --with-zlib=/opt/nginx/zlib-1.2.11 --with-openssl=/opt/nginx/openssl-1.0.2n --add-module=/opt/nginx/ngx_brotli --with-http_v2_module Configuration, add in the http section http { include mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; keepalive_timeout 65; #Brotli Compression brotli on; brotli_comp_level 6; brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml; … Restart, refresh the page to view the header, and find that there is accept-encoding:gzip, deflate, br As shown in the figure This means brotli compression is enabled. Configuration Instructions Instruction Introduction ngx_brotli defines the following directives: brotli, whether to allow dynamic compression of response data, optional values are on and off, and the default value is off. An example is as follows: brotli on; brotli_types, when dynamic compression is enabled, the MIME types allowed to be compressed, the default value is text/html. An example is as follows: brotli_types text/plain text/css text/xml application/xml application/json text/javascript application/javascript application/x-javascript; brotli_static: whether to allow searching for pre-processed compressed files ending with .br. The optional values are on, off, and always. The default value is off. An example is as follows: brotli_static off; brotli_comp_level, compression level, the optional value range is 0~11, the default value is 6. An example is as follows: brotli_comp_level 11; brotli_buffers, the number and size of buffers to use when compressing response data. An example is as follows: brotli_buffers 16 8k; brotli_window, the window value used by brotli, the default value is 512k. An example is as follows: brotli_window 512k; brotli_min_length, the minimum length of the response data. If the length is lower than this value, the brotli algorithm will not be used to perform compression operations. The brotli algorithm uses Content-Length to determine the length of the response data. An example is as follows: brotli_min_length 20; The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
>>: How to quickly install and deploy MySQL in Windows system (green free installation version)
<br />When discussing with my friends, I men...
Mininet Mininet is a lightweight software defined...
VNC is a remote desktop protocol. Follow the inst...
1. Create a SpringBooot project and package it in...
This article example shares the specific code of ...
background I talked to my classmates about a boun...
The latest Perfect Aloe Vera Gel packaging box ha...
1. Introduction MDL lock in MYSQL has always been...
Prerequisite: Percona 5.6 version, transaction is...
Let me first explain why the text is not vertical...
When the DataSource property of a DataGrid control...
If you want to adjust the size and number of Inno...
The MySQL database does not have an incremental b...
What is ELK? ELK is a complete set of log collect...
Table of contents 1. Let’s start with the conclus...