Wednesday, May 4, 2016

Saving Bandwidth with Chrome’s Data Saver

Chrome Data Saver

You’d think that, with the growing importance of mobiles, developers would be catering to them, creating awesome, low bandwidth sites that load quickly when you’re out and about.

Overall though, you’d be wrong. Each year the average page weight / number of resources has increased, this year is looking to be no different as page weight has increased over 16%.

With all of the fancy animations, scrolling elements and other pretty things eventually comes a slower web, as download speeds struggle to keep up with page sizes.

If you want to speed up your browsing experience and reduce how much you download, it might be worth looking into Chrome’s Data Saver option.

Introducing Data Saver

Data Saver is a new feature for Chrome that works to reduce mobile data usage significantly.

Starting way back in 2014, Chrome’s developers worked on an experimental way to reduce the total weight of pages automatically — by leveraging their own servers and technology. It’s actually fairly similar to what Opera has been offering for some time with their turbo mode.

Data Saver can be enabled on your Mobile (both Android and iOS) by activating it in your settings. Data Saver can also be activated on Opera’s desktop browser by installing the Data Saver Extension.

How Does It Work?

Essentially, Data Saver pushes the work of getting your web content to Google’s servers instead of your device.

When you send off a request to load your favorite site, instead of your browser downloading your content, Data Saver will connect with one of Google’s Optimization servers in their data center and provide the optimized content on your behalf. Here’s a quick illustration:

Chrome Data Saver overview

Image from Google’s blog

What Does Data Saver Actually Do?

Data Saver works by passing Chrome’s network traffic through Google’s servers. The server performs automatic compression, minification, conversion of images and other elements to save you precious bandwidth.

There are several steps to the optimization process that Google implements to bring this all together.

Content via HTTP/2

Where possible, the optimization servers request the content via HTTP/2 instead of HTTP. HTTP/2 is a supercharged version of HTTP. Instead of having dozens of connections, there’s just one co-ordinated TCP connection, cutting down on the server back-and-forth traditionally associated with HTTP — thus helping you get get your content faster. In addition, HTTP/2 can cache future resources so that they can be instantly loaded when needed.

Automatic conversion of images

Images and rich media are among the slowest components to download. Sometimes a single image can weigh more than dozens of scripts and style sheets.

With Data Saver, the optimization server performs an automatic conversion to the new WebP format. WebP is a new image format that supports both lossless (like PNG) and lossy (like JPG) formats. The automatic conversion to WebP saves an impressive amount of space: on average, lossless images such as PNGs, when converted, became 25% smaller, and lossy images such as JPGs are reduced by up to 34%.

You’d think the quality would reflect the size, but the differences between them are marginal. (You can see a comparison on the Google Developers site.)

No images shown at all

For slower connections, instead of optimizing your images, Google will opt to send you no images at all. Once the page has loaded, it will prompt you with an option to enable images (which it will then fetch, compress and send down to the browser).

There’s no way to force this by default, so if you’re on a decent 3G connection — or even 4G — there’s no option to automatically opt to do this (it’s up to Google’s discretion, it seems).

Minification and compression

Another part of the optimization process is that all resources will be automatically minified.

Google’s server will go through all CSS, JS and HTML content and automatically remove all whitespace to cut down on size. It also ensures that all content is served with gzip compression (further speeding up the process).

Better DNS requests

When your device requests a site, often it will have to do a DNS lookup (to convert the URL to an IP address). As part of the compression process, Google’s server will perform the DNS request and either get the information it needs from its cache or fetch it directly.

This might seem like a small enhancement, but this does help to reduce name resolution and speed the whole process up.

Privacy and secured traffic

One thing to note is that Data saver will only work with standard HTTP traffic. As soon as you want to load a secure page over HTTPS, or if you’re using Incognito Mode, Data Saver will switch itself off and the page will be processed like usual.

Continue reading %Saving Bandwidth with Chrome’s Data Saver%


by Simon Codrington via SitePoint

No comments:

Post a Comment