Jeremy Wagner's

Web Dev Blog

HTTP/2 in Developing Nations

6 October, 2016

Hey, guys! I talk about HTTP/2 (and other stuff) in my upcoming book from Manning publications on web performance. Maybe check it out if that's your kind of thing. In any event, I hope you like this post!

I've been doing some research on HTTP/2 use across the world in preparation for an article on another outlet. In doing so, I've observed some compelling relationships between HTTP/2 support by browser, the developing world, and internet infrastructure quality.

In developed nations, we see often see that internet infrastructure quality is pretty good in comparison to developing nations. That's not to say that some developed nations couldn't stand to do better, but they're often better by comparison. Let's take a quick look at this graph of average and peak connection speeds in the world's top 8 developing nations by population, courtesy of Akamai's second quarter State of the Internet Report for 2016:

Read More »
Average and peak internet speeds in the top 8 developed nations by population.
Average and peak internet speeds in the top 8 developed nations by population.

Seems pretty much par for the course. South Korea leads by quite a bit, but beyond that, most other developed nations are pretty comparable. Now let's see what internet infrastructure looks like in the top 8 developing nations by population:

Average and peak internet speeds in the top 8 developing nations by population.
Average and peak internet speeds in the top 8 developing nations by population.

Now we're looking at a completely different picture. Forget about peak speeds for a minute, and just look at average speeds. Developing nations have much more fragile internet infrastructure by comparison. Now let's correlate this information to HTTP/2 support. What does browser support for HTTP/2 look like in the same set of developed nations? As always, data from caniuse.com gives us an idea:

Browser support of HTTP/2 in the top 8 developed nations by population.
Browser support of HTTP/2 in the top 8 developed nations by population.

Not too bad. Support ranges between 65% and 85%. There is a grey area here in the way of what caniuse considers "partial support", which means that some browsers may or may not support the protocol based on any number of conditions. A good example of this concept is IE11. On Windows 10, IE11 supports HTTP/2, but not on earlier versions of Windows.

Okay, let's get out of the weeds. What does HTTP/2 support in browsers look like in developing nations?

Browser support of HTTP/2 in the top 8 developing nations by population.
Browser support of HTTP/2 in the top 8 developing nations by population.

If you care about web performance, then this correlation should be illuminating for you. What we're seeing is that developing nations with a poorer quality of internet infrastructure don't have the same support for HTTP/2 in the browser that those in the developed world do.

So what does this mean? Consider for a moment that these people are visiting sites that may be HTTP/2-enabled. Those same sites may also be optimized for HTTP/2, which means they're abandoning HTTP/1 optimization patterns. What happens when someone using a browser incapable of understanding HTTP/2 visits that site? The connection downgrades to HTTP/1. This means that all of your HTTP/2-specific optimizations are now detrimental to those users.

There are some things you can do to counteract this. You could just carry over your HTTP/1-specific optimizations to an HTTP/2 environment. Those optimizations don't necessarily slow down your site on HTTP/2, it just makes caching less efficient when assets change. Or, if your site's architecture is complex enough, you could change how you deliver assets based on the user's protocol version. I do that on this site on the back end in PHP by storing the protocol version as a boolean variable:

$isHttp2 = stristr($_SERVER["SERVER_PROTOCOL"], "HTTP/2") ? true : false;

With this simple boolean, I can change how I deliver assets on the front end. I can serve image sprites for HTTP/1 users in lieu of separate images by tagging the <html> tag with an http1 class that I can target with CSS. I can serve combined CSS and JavaScript files for HTTP/1 users in lieu of more granular ones. I can choose to inline some CSS and scripts for HTTP/1 users, and use Server Push for HTTP/2 users.

There's a lot you can do with this information. Analyze the capabilities of your audience, and make critical decisions based on your findings. The capabilities of users is changing constantly, though, so reassess periodically and see what's worth your time. You can plug in your Google Analytics data into caniuse.com to see what features your specific audience supports. Hopefully this gives you some perspective on how we need to think about the capabilities of our users.

—j