Why I'm Excited About HTTP/2
As of writing 2.3% of the top 10 million websites support HTTP/2 (source). I’m really looking forward to that number skyrocketing over the coming years.
HTTP/2 is the first major change to the HTTP standard in 18 years, you could say it’s graduating high school. Surely that’s cause for celebration!
The two aspects of HTTP/2 that are most exciting are as follows:
- Faster page loading (by reducing latency)
- Allowing servers to push data (instead of purely relying on clients requesting it)
HTTP/2 is completely backwards compatible, but will introduce new methods to allow web apps to upgrade at their own pace.
The most obvious benefit comes from loading a webpage. In HTTP/1.1 (there was never really a HTTP/1.0) the client (browser) sends a request to a server, the server responds with the HTML in a HTTP response, the browser then parses the response, looks for HTML links to other resources (like JavaScript, CSS, or images) each of which will require another HTTP request (and corresponding response).
HTTP/2 provides a mechanism to streamline this process. When the client requests a page isn’t it obvious that the server knows at that point all the data the client needs to render the page? Shouldn’t it all be sent in one stream, rather than several back-and-forths? This is what HTTP/2 does.
This doesn’t stop the server from sending the basic neccessities first (like just the HTML), which is useful for people on slow connections (imagine having the wait for every resource to load before you could see ANY). Rather, HTTP/2 just keeps the one connection open through which data can flow freely in both directions, as opposed to separate connections.
There is a demo of HTTP/2’s speed increases on Akamai.com here. I found this demo to show a much larger difference on my mobile device, than on a wired desktop. But there still was a noticeable difference!
HTTP/2 is a direct development from Google’s HTTP replacement called SPDY (“speedy”). Google (and other sites) have been using this protocol for a while now. The first draft of the HTTP/2 standard was a straight copy of SPDY, but the standard now contains more features and more performance improvements than SPDY provided.
Httpwatch.com has an interesting comparison of the performance improvements of HTTP/2 over SPDY and HTTP/1.1.
Interested in reading more about HTTP/2? The Wikipedia article is a good starting point.
If you enjoyed this post, please check out my other blog posts.