Sunday, December 31, 2017

Google Brings Brotli Compression To Deliver Faster OTA Android Updates

 

When it comes to phones, people usually go for the company who provides longer OTA updates support. But nobody thinks about the size of an OTA because they generally downloads in the background over WiFi, but it’s actually a big deal on the server back end. You can make a huge difference even if you save few megabytes of data  since the gains are multiplied by potentially hundreds of thousands of users. Google saw this and been working to bring its Brotli compression algorithm to Android for faster OTA updates.




For those who is wondering what is the Brotli Compression Algorithm? Basically Brotli is a compression algorithm developed by Google employees that significantly improves the compression ratio over other algorithms such as GZIP while also demonstrating an impressive decompression speed. The disadvantage of all of this is the Brotli algorithm is rather slow, so it’s generally avoided when compressing dynamic content.

Left: Compression Ratio Comparison / Middle: Decompression Speed / Right: Comparison Compression Speed Comparison

On the other hand, any static content such as web pages are suitable to be compressed via the Brotli algorithm. This includes application files downloaded from the Google Play Store. Since there are well over 2 billion Android devices out there, shaving off even small amounts of data when serving a patch file from the Play Store can result in massive gains for Google. The Brotli algorithm, when used for Play Store app downloads, saves users 1.5 petabytes (1.5 million gigabytes) of data each day.

Now lets come to the main part, which is how all of this will improve OTA updates? As you might know, OTA updates aren't that frequent compared to Play Store app updates but quite large in comparision. 

Since Brotli also brings improved decompression speeds, that also means that OTA updates can be applied more quickly. OTA updates are sent to each device as an archive, so before the patches can be made via bsdiff, the archive needs to be decompressed. Since Brotli decompression is rather quick that means decompressing the archive will also be quick, resulting in faster patching of system files.

However, users on devices with A/B partition schemes such as the Google Pixel/Pixel 2, Essential Phone, Razer Phone, Moto Z2 Force, and Xiaomi Mi A1 probably won’t notice this particular improvement since the updates are seamlessly applied on the inactive partition in the background. Still, even for these devices, the smaller OTA update package due to Brotli compression will result in reduced bandwidth for the user.



Soure : (1), (2), (3)