HTTP2 vs HTTP 1.1

What is HTTP?

Hypertext Transfer Protocol (HTTP) is an application protocol that is, currently, the foundation of data communication for the World Wide Web.

HTTP is based on the Client/Server model. The client/Server model can be explained as two computers, Client (receiver of service) and Server (provider of service) that are communicating via requests and responses.

A simple and abstract example would be a restaurant guest and a waiter. The guest (Client) asks (sends request) a waiter (Server) for a meal, then the waiter gets the meal from the restaurant chef (your application logic) and brings the meal to the guest.

What is HTTP1.1?

Http1.1 is the most common method of getting data from the server by opening a TCP connection asking for something, like index.html, then closing it back again so, many connections are opened individually, to get various files that a site requires to be displayed in the device properly and that is very slow as many connections are opened and for each thing, a get request is generated.

What is HTTP/2?

In 2015, the Internet Engineering Task Force (IETF) released HTTP/2, the second major version of the most useful internet protocol, HTTP. It was derived from the earlier experimental SPDY protocol.

Differences between HTTP1.1 and HTTP2?

left is http1.1 right is http2

  1. HTTP/1.1 opens a TCP link every time it sends a request while HTTP/ 2 just has one TCP link over which data is sent.
  2. HTTP/1.1 asks for each thing that it requires to display the site, but whereas HTTP/2 uses server pushing which means that when HTTP/2 asks for “index.html” or any file server will also give as much data as it can over the same link because it knows that you also need those files to display the site.
  3. HTTP/1.1, as asks for lets, say an image, the probability is that in HTTP/2 has already got the image dude to server pushing and because there is one TCP link only, The image is sent much faster and loads much faster.

Benefits of HTTP/2?

HTTP/2 is much faster because of the various methods it utilizes to properly display a site.

  1. Domain sharding is not required
  2. Single tcp connection, instead of many.
  3. Binary protocol instead of textual protocols.
  4. Server push
  5. increased security, like browsers, only support HTTP/2 over an encrypted connection.
  6. Faster loading times

You see the first thing that they have improved is that instead of opening multiple TCP connections, it opens one connection and gets all the files through that, but does that make it much faster, no that does decrease the time it takes for the things to come through but, the main reason is server pushing, so you see just thing that the server knows that to load the site you will need index.html, script.js, and all the other files so once when the device asks for just index.html, the server also pushes as much data as possible without being asked for and that makes it faster, so when the device asks for index.html, the server will push, script.js any images it finds, And style.css and as much data it can over that single connection. That does also decreases the time required for loading an image as they are already pushed.

--

--

--

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

Deep Dive into React’s JSX

Deep Dive into React’s JSX

Welcome to Koa(tutorial -03)

Positional Lists in TypeScript

setTimeout in Google Cloud Functions is kinda messy?

Notes on React

Salesforce Surveys for Chat

Bifunctors in TypeScript

Adding bootstrap in React 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
Balaji sankar

Balaji sankar

More from Medium

Compiled vs Interpreted Languages, which one is better? Explain like I’m 5

Chapter 14- Saving Objects

Sidekick Recipes #1: Elasticsearch Ingest

Optimize Memory to increase the performance of your Unity game