Be HTTP/2.0 ready in 2018

If you have spent a lot of your time in the past year trying to optimize your web interfaces and services to process more web requests, reduce the latency, improve the performance, break the data stream limits with existing architecture and rewriting old components to be scalable – you are not alone (I’m not talking about UFO). Do not be ashamed if you miss that all these problems faced in the modern web and even some that you did not think of are addressed with the new Hypertext Transfer Protocol 2.0 and already provides a promising solution for most of them.

A New Year is coming. Rejoice the holidays and read some articles about latest technologies without developing anything (at least try not to). Discuss them with the other geeks at the barbeque evenings around New Year’s Eve.

That’s how I went deep into HTTP/2.0 by playing with the new Alexa Voice Service and thinking what problems they solved by using it. As long as I became acquainted with the specifics of the protocol, many cases arose in my mind when a solution had to be found for some limitation problems with web services and I began to see alternative solutions.

Consider starting any new projects using HTTP/2.0 communication layer and plan migrating the old ones to the new generation protocol. Let’s look at what it gives and what it promises:

  • A negotiation mechanism for choosing between HTTP/1.x and HTTP/2.x (*and future transports).

It is backward compatible with old web clients. In fact all browsers support it in its current versions. You may be dependent of some headless API clients compiled with old libraries that are not ready, but its mandatory to keep all up to date anyway for security reasons (and the retirement of TLS 1.x).  

See Example how to compile libcurl with http2 support.

  • Header compression.

Sounds good. In many API services the headers are larger in size than the payload data and unnecessarily consume bandwidth. But I’m wondering… a lot of *smart* network equipment or proxies are inspecting headers for routing and caching optimizations. Is all the available hardware ready for it?

  • Server push.

This will definitely change the web! Streaming and delivering live changes to the clients is a key component for business services and any modern cloud based software. The HYBI Working Group is preparing a future extension of HTTP/2.0 to carry the WebSockets semantics. I’m pretty excited. Bi-directional data streams can open the door for a brand new kind of online applications, Internet of Things solutions and interactive web content.

In short – HOL blocking is a performance issue that occurs when a bunch of packets is blocked by the first packet in line. Solving this problem will reduce the network latency and make the Internet faster.

  • Not require multiple connections to a server to enable parallelism.

The idea behind this feature is to use a single TCP connection. At very low level, opening a TCP Socket is a long handshaking process and negotiation dialog between the server and client that exchanges several packets before the transport layer start transferring the desired data. However it is a common practice to split the content in smaller files and load it with separate requests, because in real this approach shows better results. Well in HTTP/2 we can think of frame based data delivery instead over parallel requests. This way a single server can handle more requests with the same hardware and network bandwidth.

At the end of the day we want to provide better user experience (speed, interactivity) and reduce the costs (memory, computing power and storage) for the online services we build.

I wish you to be HTTP/2 ready in 2018!

10x for reading.