HTTP/2 Multiplexing
HTTP/2 multiplexing is the ability to send multiple concurrent HTTP requests and responses over a single TCP connection simultaneously, using a framing layer with stream IDs to interleave request and response data without head-of-line blocking at the HTTP layer.
HTTP/2 multiplexing is the ability to send multiple concurrent HTTP requests and responses over a single TCP connection simultaneously, using a framing layer with stream IDs to interleave request and response data without head-of-line blocking at the HTTP layer.
HTTP/1.1's primary performance limitation is that each TCP connection can handle only one outstanding request at a time (without pipelining, which was poorly supported). Browsers worked around this by opening 6 TCP connections per origin — each requiring its own TCP and TLS handshake. HTTP/2 solves this at the protocol level.
Binary Framing Layer: HTTP/2 replaces HTTP/1.1's text-based request/response format with a binary framing layer. All communication is split into frames (HEADERS, DATA, SETTINGS, WINDOW_UPDATE, etc.) with a fixed 9-byte frame header containing the stream ID.
Streams: A stream is a bidirectional sequence of frames within an HTTP/2 connection. Each request/response pair occupies one stream with a unique integer ID (client-initiated streams use odd IDs; server push uses even IDs). Streams are independent — a slow response on stream 3 doesn't block streams 5 and 7.
Header Compression (HPACK): HTTP headers are compressed using a static and dynamic table indexed dictionary, significantly reducing overhead for requests with large or repeated headers (e.g., cookies, Authorization).
Server Push: The server can proactively send resources (CSS, JS, images) to the client before they're explicitly requested, using even-numbered stream IDs. In practice, this feature was complex and saw limited adoption; it was removed from HTTP/3.
TCP Head-of-Line Blocking: HTTP/2 eliminates HTTP-level HOL blocking, but TCP-level HOL blocking remains: a single lost TCP segment stalls all streams until retransmission. HTTP/3 resolves this by using QUIC streams over UDP.