A detailed explanation of Brotli algorithm to save CDN traffic

A detailed explanation of Brotli algorithm to save CDN traffic

In the early years, when I was a student, I often tinkered with my own personal website. The most troublesome problem for me was that the source server was prone to crash. As a student, on the one hand, I did not have enough money to buy a high-quality server, and on the other hand, the annual traffic fee was quite expensive, which cost me a lot of living expenses.

Similarly, video websites with a large user base face problems in data requests and transmission every day. Reducing website traffic through the right methods can also help the website save costs.

So is there any good way to help us reduce website traffic expenses and reduce the pressure on the source server?

Lower-priced CDN

In recent years, CDN prices have been getting lower and lower, which has allowed me to find a perfect solution. Generally speaking, after a website turns on CDN acceleration, the website content will be cached on the CDN node server. At this time, if there is an access, the website data will be directly returned from the CDN node server, and there is no need to retrieve data from the source site.

This method solves the problem of the source site always crashing. At the same time, the price of CDN traffic is much lower than that of the source site traffic. As long as it is properly set up, it can significantly reduce the website's traffic expenses.

CDN with higher technical content

In addition to lower prices, the technical content of CDN has also become increasingly higher in recent years. This article takes the Brotli compression algorithm of Youpai Cloud CDN as an example to explain how it reduces traffic consumption.

Google believes that Internet users' time is valuable and should not be wasted on useless web page loading, so it launched the lossless compression algorithm Brotli. Brotli compresses data through a variant of the LZ77 algorithm, Huffman coding, and second-order text modeling.

Higher compression rate


image.png

From the above figure, we can see that Brotli has a clear advantage in compression ratio compared with the commonly used compression algorithms bzip2, gzip, and lzma2.

Faster decompression speed

For today's Internet, the most important performance may be decompression speed. Even in the case of limited resources such as browsers and mobile devices, the client can decompress quickly and provide a better user experience is what we are pursuing now. In terms of decompression speed, Brotli still performs well.


image.png

From the figure we can see that Brotli's decompression speed is very similar to Gzip, but far exceeds bzip2 and lzma2. Although they have better compression ratios than Gzip, their decompression speeds are several times slower, and compared with Brotli, their advantages disappear.

Compared with the commonly used compression algorithms, Brotli has obvious advantages. Compared with Gzip, Brotli's compression performance in web resource compression is improved by 17%-25%. When Brotli compression level is 1, the compression rate is higher than when Gzip's highest compression level is 9.

Browser compatibility

The Brotli algorithm has quickly become popular in the industry due to its excellent compression performance. So far, almost all mainstream browsers, except IE and Opera Mini, support the Brotli algorithm.


image.png

As CDN technology continues to mature, the proper use of CDN can greatly reduce the concurrency pressure encountered by the source server, reduce the source traffic, and save costs. At the same time, CDN's anti-D means are also developing, and we don't have to worry about "going bankrupt" due to DDoS attacks (I didn't dare to use CDN because of this back then, haha).

You don't have to worry about how to use the Brotli compression algorithm. You can use the high-performance web resource compression algorithm by simply connecting to the CDN. Since not all browsers support the Brotli algorithm, at the CDN edge node, Youpai Cloud will provide both files compressed by the Brotli algorithm and original resource files. When the client does not support the Brotli algorithm, Youpai Cloud will choose to provide the Gzip algorithm to compress the original file and provide it to the client. When the client supports both algorithms, Youpai Cloud CDN will give priority to responding to the br version file.

With the help of the more efficient Brotli algorithm, CDN traffic can be reduced by 20% compared to Gzip compression. It is indeed a good choice to save traffic costs and provide users with a better user experience.

<<:  Analysis on the development trend of indoor distribution system in the 5G era

>>:  On the Importance of Redundant Backup in Data Centers

Recommend

How professionals can develop their latest data center skills

When there are a plethora of industry certificati...

Why do we need a websocket protocol when there is an HTTP protocol?

Usually when we open a web page, such as a shoppi...

Why 99% of business leaders are paying attention to this issue

Digitalization and the provision of digital servi...

The network was interrupted for 30 minutes! Operator: Please restart your phone

At 1:50 p.m. local time on March 29, Japanese ope...

Simple test of DogYun Korean data center elastic cloud server

The blog has shared DogYun product information se...

DIY is not the best way to implement SD-WAN

Wide Area Networks (WANs) are not designed for th...

5G is coming. How long can 4G hold out? Will WiFi still have the last laugh?

The mobile phones in Carmen, Mong Kok seem to hav...

Domestic IPv6 system deployment speeds up and IPv6 application boom is coming

The current Internet Protocol address IPv4 addres...

10 solutions for high-concurrency and high-traffic websites

1. Hardware upgrade An ordinary P4 server can gen...

Online interview experience: Is it absolutely safe to use HTTPS?

[[421374]] This article is reprinted from the WeC...