Exploring http2 (Part 1): Overview

source: https://css-tricks.com/

The complete code can be found on github.

Part 1: Overview
Part 2: Exploring with node-http2 core and hapijs

What is http2?

The http2 protocol is focused on performance; specifically, end-user perceived latency, network and server resource usage. (Read about the specifications here)

Why http2?

Loading a web page is resource intensive, as HTTP/1.1 only allows one outstanding request per TCP connection. The web needed an update which brings in advancements in efficiency, security and speed.

How does http2 solve performance problems?

Improvements http2 brings in:

  • Single Connection: Only one connection to the server is used to load a website and that connection remains open as long as the website is open. This reduces the number of round trips needed to set up multiple TCP connections. (more info here)
  • Multiplexing: Multiple requests are allowed at the same time, on the same connection. Previously, with HTTP/1.1, each transfer would have to wait for other transfers to complete. (more info here)
  • Server Push: Additional resources can be sent to a client for future use. (more info here)
  • Prioritization: Requests are assigned dependency levels that the server can use to deliver higher priority resources faster. (more info here)
  • Binary: Makes HTTP/2 easier for server to parse, more compact and less error-prone. No additional time is wasted translating information from text to binary. (more info here)
  • Header Compression: HTTP/2 uses HPACK compressions, which reduces overhead. Many headers are sent with the same values in every request in HTTP/1.1. (more info here)

When can we start using http2?

Now!

Here is the timeline,

source: https://www.polyglotdeveloper.com/

Yes, from 1999 to today we(most) are using same good old http1.1; 15 years!

How to start using http2?

According to Can I Use, ~83% browsers online support http2 already

http1.1 (left) vs http2 (right); let’s build this in next section

Part 1: Overview
Part 2: Exploring with node-http2 core and hapijs

The complete code can be found on github.

If you found this story useful, please support it by clapping 👏

--

--

I Code. I Paint. I Ride

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store