Comparing HTTP1.1 vs HTTP2

Recently, I started learning about the evolution of HTTP protocols and how HTTP2 can improve its performance compared to HTTP1.1. And I found a pretty interesting difference between how the connection works on both of the protocols. Here is the gist of it.

Improvements in HTTP1.1 over HTTP1

Improvements in HTTP2 over HTTP1.1

Demo Time:

I have cropped an image of 500x500 to 50x50 to create 100 images and then loaded them all in a single html file using image tags. This is a bit exaggerated example since in the real world we don't have that many assets for a single document. But it is a good example to understand the capabilities of http2.

In this example, http2 is around 5x (~10.5s in HTTP1.1 vs ~2.1s in HTTP2 in Fast3G) faster than http1.1 which shows the power of multiplexing over a single TCP connection.

HTTP1.1 Example

http1 Example

HTTP2 Example

http2 Example

You can checkout full code in my github repo here

Please feel free to message me if you want to improve this article.