Skip to main content

HTTP 2

HTTP/2 can make our applications faster, simpler, and more robust.

Goals​

The primary goals for HTTP/2 are to:

  • πŸ”„ Reduce latency by enabling full request and response multiplexing.
  • πŸ—œοΈ Minimize protocol overhead via efficient compression of HTTP header fields.
  • πŸš‘οΈ Request prioritization
  • 🌐 Server push
note

HTTP/2 does not modify the application semantics of HTTP in any way. All the core concepts, such as HTTP methods, status codes, URIs, and header fields, remain in place.

🎞️ Instead, HTTP/2 modifies how the data is formatted and transported between the client and server. New Binary Framing Layer

Binary Framing Layer​

πŸ”„ Request and Response Multiplexing​

With HTTP/1.1, if the client wants to make multiple parallel requests to improve performance, then multiple TCP connections must be used. This workaround was applied because of the HTTP/1.1 delivery model 🚚, which ensures that only one response can be delivered at a time (response queuing [🚢🚢🚢🚢]) per connection. This delivery model also results in 🚧 head-of-line blocking and inefficient use of the underlying TCP connection (cuz multiple connections are used).

🎞️ The new binary framing layer in HTTP/2 removes these limitations πŸ’©, and enables full request and response multiplexing, by allowing the client and server to:

  1. βœ‚οΈ break down an HTTP message into independent frames
  2. interleave them
  3. πŸ—ƒοΈ reassemble them on the other end
note

request and response multiplexing

The above image captures multiple streams within the same connection:

  • The client is transmitting a DATA frame to the server
  • The server is transmitting an interleaved sequence of frames to the client.

πŸš‘οΈ Stream Prioritization​

🌐 Server Push​

πŸ—œοΈ Header Compression​

References​