Head-of-line blocking in HTTP/2 vs HTTP/3#
2024-06-18
HTTP/2 was supposed to solve head-of-line (HOL) blocking with multiplexing. It did — at the HTTP layer. But it introduced a new kind at the TCP layer. HTTP/3 (over QUIC) fixes that.
HTTP/1.1 HOL blocking#
One request at a time per connection. If request 1 takes 5 seconds to respond, requests 2-N have to wait 5 seconds. Browsers worked around this by opening 6 connections in parallel.
HTTP/2 multiplexing#
Multiple streams share one TCP connection. Request N doesn't wait for request 1. Solved at the HTTP layer.
But: TCP is a byte stream, not a message stream. If a packet in the middle of the connection is lost, the receiver's kernel can't hand subsequent bytes to the application until the lost packet is retransmitted. This blocks all HTTP/2 streams on that connection.
Practical impact: on a lossy path (1% loss), HTTP/2 performs worse than HTTP/1.1 with 6 connections, because HTTP/1.1's 6 connections give you 6 independent retransmit chances.
HTTP/3 = HTTP over QUIC#
QUIC is a new transport that runs over UDP and implements its own reliability, congestion control, and multiplexing. Crucially, QUIC's multiplexing is at the transport layer:
- Each QUIC stream has its own flow control and its own retransmit queue.
- Loss on stream A doesn't block stream B.
So HTTP/3 gets true stream-level HOL isolation.
When each matters#
- Datacenter (~0% loss): HTTP/2 is fine.
- Mobile / bad WiFi (~1-5% loss): HTTP/3 wins substantially.
- Satellite / very high latency: QUIC's 0-RTT handshake and better loss recovery pay for themselves.
Practical caveats#
- QUIC over UDP is sometimes blocked by middleboxes. All modern browsers fall back to HTTP/2 if QUIC handshake fails.
- QUIC uses more CPU per byte than TCP (userspace stack, encryption of everything including packet numbers). For high-throughput internal services, TCP+TLS may still be preferable.
- HTTP/3 is not automatically faster — measure before switching.
Reference#
- Iyengar & Thomson, QUIC: A UDP-Based Multiplexed and Secure Transport (RFC 9000).
- Bishop, HTTP/3 (RFC 9114).