Brotli Explained

Brotli
Logo Size:64px
Author:Jyrki Alakuijala, Zoltán Szabadka
Developer:Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne
Programming Language:C
Operating System:Cross-platform
Platform:Portable
Genre:Data compression
License:MIT License

Brotli is a lossless data compression algorithm developed by Google. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd-order context modelling. Brotli is primarily used by web servers and content delivery networks to compress HTTP content, making internet websites load faster. A successor to gzip, it is supported by all major web browsers and has become increasingly popular, as it provides better compression than gzip.

History

Google employees Jyrki Alakuijala and Zoltán Szabadka initially developed Brotli in 2013 to decrease the size of transmissions of WOFF web font.[1] Alakuijala and Szabadka completed the Brotli specification during 20132016. The specification was accompanied with a reference implementation developed by two additional authors, Evgenii Kliuchnikov and Lode Vandevenne, who had previously developed Google's zopfli implementation of deflate and gzip compatible compression in 2013.[2] Unlike zopfli, which was a reimplementation of an existing data format specification, Brotli was a new data format and allowed the authors to improve compression ratios even further.

The Brotli specification was generalized in September 2015 for HTTP stream compression (content-encoding type "br"). This generalized iteration also improved the compression ratio by using a predefined dictionary of frequently used words and phrases. The version of Brotli released in September 2015 by the Google software engineers contained enhancements in generic lossless data compression, with particular emphasis on use for HTTP compression. The encoder was partly rewritten, with the result that the compression ratio improved, both the encoder and the decoder have been sped up, the streaming API was improved, and more compression quality levels have been added. Additionally, the new release shows performance improvements across platforms, with decoding memory reduction.

The Internet Engineering Task Force approved the Brotli compressed data format specification as an informational request for comment in July 2016.[3] The Brotli data format is an integral part of the 2nd iteration of the Web Open Font Format, which was recognized in a 2021 Technology & Engineering Emmy Award from the National Academy of Television Arts & Sciences for font technology standardization at W3C.[4] [5]

Brotli support has been added over the years to web browsers, with 96% of worldwide users using a browser that supports the format, as of July 2022.[6]

In 2016 Dropbox reimplemented Brotli in Rust to fulfill their requirement to be more secure against a malicious client. In 2018 they implemented the missing feature so one can append to a Brotli compressed file.[7] [8] [9]

Algorithm

Brotli's new file format allows its authors to improve upon Deflate by several algorithmic and format-level improvements: the use of context models for literals and copy distances, describing copy distances through past distances, use of move-to-front queue in entropy code selection, joint-entropy coding of literal and copy lengths, the use of graph algorithms in block splitting, and a larger backward reference window are example improvements.

Unlike most general-purpose compression algorithms, Brotli uses a predefined dictionary, roughly 120 KiB in size, in addition to the dynamically populated ("sliding window") dictionary. The predefined dictionary contains over 13000 common words, phrases and other substrings derived from a large corpus of text and HTML documents.[10] Using a predefined dictionary has been shown to increase compression where a file mostly contains commonly used words.[11] However, according to Alakuijala, the predefined dictionary does not distract from Brotli's generality, and is not the main reason for improved compression. Brotli with an all-zero dictionary still performs well on web content due to the algorithmic advances, he claims.[12]

Brotli's sliding window is limited to 16 MiB. This enables decoding on mobile phones with limited resources, but makes Brotli underperform on compression benchmarks having larger files. The constraints of the small window size can be alleviated by using Large Window Brotli, which is not compatible with RFC7932 (Brotli proper).[13]

Name

While Google's zopfli implementation of the deflate compression algorithm is named after Zöpfli, the Swiss German word for a snack-sized braided buttery bread, brotli is named after Brötli, the Swiss German word for a bread roll.[14] Google's own implementation of the Brotli specification was released under the terms of the permissive free software MIT license in 2016. A formal validation of the Brotli specification was independently implemented by Mark Adler, one of the co-authors of the zlib/gzip compression format and library. Adler's implementation was released under the terms of the similarly permissive Apache License.[15] Other implementations of the specification also exist, including one in the source-to-source Haxe language.

Applications

Brotli compression is generally used as an alternative to gzip on the web, as Brotli provides better overall compression.[16] Compared to gzip compression, JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller.[17]

The reference implementation does ship a command-line program similar to,[18] but use in the Unix-like world as a simple compressor is scarce. Libarchive developers find the raw stream format of .br files difficult to support, as there is no magic number to indicate the file format.[19]

Industry support

Browsers and other clients

Web servers

References

Notes
  • - .

    External links

    Notes and References

    1. .
    2. .
    3. .
    4. Web site: 2022-06-01 . W3C Receives Emmy Award for Standardizing Font Technology .
    5. Web site: 2022-06-01 . Changing the face of the web: W3C Web Fonts Working Group and MPEG recognized with a Technology & Engineering Emmy Award .
    6. Web site: 2022-06-28 . Can I use... - Brotli .
    7. https://dropbox.tech/infrastructure/lossless-compression-with-brotli Lossless compression with Brotli in Rust for a bit of Pied Piper on the backend
    8. https://dropbox.tech/infrastructure/-broccoli--syncing-faster-by-syncing-less
    9. https://github.com/google/brotli/issues/628 append to brotli compressed file
    10. .
    11. Book: 10.1109/CIT.2007.22 . Word Indexing for Mobile Device Data Representations . 7th IEEE International Conference on Computer and Information Technology (CIT 2007) . 399–404 . 2007 . Larkin . Henry . 978-0-7695-2983-7 . 8707991. .
    12. Web site: Alakuijala . Jyrki . Static dictionary is not why Brotli reaches excellent compression density. Much ... . Hacker News . May 15, 2021.
    13. Web site: Kliuchnikov . Eugene . How to use large window sizes? · Issue #639 · google/brotli . GitHub . en . Currently we are testing "Large Window Brotli" extension that will allow up to 1GiB window. [...] "Large Window Brotli" is landed..
    14. .
    15. .
    16. Web site: Calvano . Paul . 2018-07-25 . Brotli Compression: How Much Will It Reduce Your Content? . 2021-03-07.
    17. Web site: Pandjarov . Hristo . 2021-01-13 . More Site Speed Gains with Brotli Compression Algorithm . 2021-03-07 . SiteGround.
    18. Web site: brotli(1) manual page . manned.org.
    19. Web site: Brotli support · Issue #1238 · libarchive/libarchive . GitHub . en . Without a magic signature, libarchive cannot automatically recognize the file type, so it cannot automatically decompress. (Libarchive does not consider the file name, only the contents.).
    20. .
    21. .
    22. Web site: Stenberg. Daniel. et al. curl - Changes. curl.haxx.se. 14 January 2018.
    23. Web site: README. GitHub. 15 October 2021.
    24. Web site: Google Brotli: How to compress, open, extract BR files.
    25. .
    26. Web site: Higher Compression Ratio with Brotli compression. 6 Oct 2023.
    27. Web site: Caching with Azure Front Door. docs.microsoft.com. 15 June 2023 .
    28. Web site: Azure Front Door Service is now available. azure.microsoft.com.
    29. Web site: Amazon CloudFront announces support for Brotli compression . aws.amazon.com.
    30. Web site: What will Cloudflare compress? . support.cloudflare.com.
    31. Web site: lighttpd 1.4.56 release info. redmine.lighttpd.net.