Why is HTTP/2 so important?

Why is HTTP/2 so important?

What is HTTP/2?

HTTP/2 (still occasionally referred to as HTTP/2.0) is the latest and greatest version of the protocol on which the Internet as we know it today was built

The new version was published on February 17th, 2015, and has since gained major traction, being supported by over a firth of the top 10 million websites according to Alexa.

One of the main goals in the creation of HTTP/2 was to reduce latency, by enabling full request and response multiplexing. It also reduced HTTP overhead, by using efficient compression of HTTP header fields. It also added request prioritization and server push support.

Unfortunately, HTTP/2 is not backwards-compatible with the previous major HTTP standard, which was confusingly named HTTP 1.1. In the case of backwards-compatibility, we would likely see it with the name HTTP 1.2. As such, HTTP/2 requires implementation in software on each the client (browser) and server side.

What about SPDY?

SPDY was an experimental protocol, developed by Google in mid-2009, with the primary goal of reducing latency using HTTP/1.1. In addition to this, SPDY required a valid SSL (Secure Sockets Layer) certificate. SPDY didn’t replace HTTP, instead it modified the way HTTP requests were sent. As seen above with the change to HTTP/2, this similarly required support from each client and the server.

SPDY was completely integrated in Chrome, Firefox and Opera by 2012, with a growing number of websites working to support the protocol server-side for a better user experience.

The HTTP Working Group noticed this movement, and it started work on HTTP/2 in short order. HTTP/2, in fact, was initially based on SPDY.

Since HTTP/2’s release, modern browser support for SPDY has been slowly decreasing. Microsoft Edge has already completely dropped support for the protocol, and even Google has dropped support for their own technology in Chrome since 2016.

HTTP/2 was built on the successes of SPDY and as such nearly all the objectives of SPDY are met within the HTTP/2 standards, leaving SPDY redundant.

Benefits of HTTP/2.

The entire protocol keeps it simple for a client’s computer to interpret the sent information, it does this by sending the data using binary code.

The new protocol also introduced a feature called multiplexing. Multiplexing allows the client’s browser to make and load multiple requests on the same connection, resulting in much faster load times making for a smoother overall browsing experience.

HTTP/2 also introduces a header compression system, called HPACK. This system works by compressing individual values before they are transferred to the server. The server in turn looks up the encoded information from previously transferred data to reconstruct the full header. This has resulted in immense performance benefits when using HTTP/2.

Finally, it gives the webserver the ability to send multiple responses for each single client request. This powerful feature allows the webserver to send extra cacheable data to the client which it anticipates the client will need but hasn’t requested yet.

What did we not get that we hoped for?

Unfortunately, HTTP/2 still allows connections over a non-encrypted (non-SSL) connections between the client and server. We’ve already produced a blog post on the importance of SSL, which we’d recommend you read.

Fortunately, some of the larger browsers have taken this matter in their own hands by only allowing the use of HTTP/2 over encrypted connections. However, be wary with any custom-written or older browsers, they may be more lenient at your own expense!

Cameron Stephen Headshot

Produced by Cameron Stephen

Cameron Stephen is a full-stack web developer who specialises in LAMP/LEMP development, confidently working with PHP, HTML5 and CSS within a Linux environment. He prefers to work using the Symfony MVC framework with Doctrine as an ORM; Git as his version control system of choice and Composer as the dependency manager - but is also fully capable in WordPress-based web development, developing bespoke websites that are fully responsive, are well optimised and bug-free.