What is head-of-line blocking, and how do HTTP/2 and HTTP/3 deal with it?
Head-of-line blocking is when one slow or lost item holds up everything queued behind it. HTTP/1.1 blocks at the request level, HTTP/2 fixes that with multiplexing but still blocks at the TCP level on packet loss, and HTTP/3 over QUIC removes even that.
Explain it simply
A single-lane road where a broken-down truck stops every vehicle behind it. HTTP/2 gives several lanes in one tunnel, but if the tunnel's floor collapses (a lost TCP packet), all lanes stop. HTTP/3 builds separate tunnels per lane.
Example
HTTP/1.1 one connection: request 2 waits until response 1 is done
HTTP/2 many streams on one TCP connection; no request-level blocking
but one lost TCP segment pauses ALL streams until retransmitted
HTTP/3 streams are independent inside QUIC (over UDP);
loss on stream A only delays stream ATCP delivers one ordered byte stream, so if segment 5 is lost, segments 6 to 20 sit in the buffer and cannot be handed to the application until 5 arrives. With HTTP/2 those later segments may belong to unrelated resources, so everything stalls.
This matters most on lossy mobile networks. A browser on a patchy 4G connection in a train gets the biggest gain from HTTP/3.
What to say in the interview
"HTTP/1.1 has blocking at the request level; HTTP/2 fixes it with streams but TCP still delivers bytes in order, so a loss stalls all streams. QUIC makes streams independent, which HTTP/3 uses to avoid that."
Common mistakes
- Believing HTTP/2 completely eliminates head-of-line blocking.