The Problem With HTTP1
Under HTTP1 one, a connection handles one request at a time. Browsers worked around this by opening many parallel connections, and a slow response could still block others queued behind it, a problem called head of line blocking.
Streams and Frames
HTTP2 introduces a binary framing layer. A single connection carries many independent streams, and each message is split into small frames that are interleaved on the wire.
- Each stream has an identifier so frames can be reassembled.
- Requests and responses no longer wait in a single queue at the HTTP layer.
- Header compression with HPACK shrinks repeated headers.
- Server push could proactively send resources, though it is now deprecated in practice.
Multiplexing Benefits
By multiplexing all streams over one connection, HTTP2 cuts the cost of TCP and TLS setup and removes HTTP layer head of line blocking. One slow response no longer stalls the others sharing the connection.
A Remaining Limit
Because HTTP2 still runs over a single TCP connection, a lost packet stalls all streams at the transport layer. HTTP3 moves to QUIC over UDP to solve that remaining blocking.
Key idea
HTTP2 multiplexes many streams of interleaved frames over one connection, removing HTTP layer head of line blocking that plagued HTTP1.