awesome-everything RU
↑ Back to the climb

Networking & Protocols

QUIC streams and head-of-line blocking

Crux QUIC multiplexes independent streams over one UDP connection so a lost packet blocks only the stream carrying it, not every other stream — a 575x improvement on lossy paths.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at junior altitude — the surface
◷ 10 min

Your HTTP/2 connection has three requests in flight. One packet is dropped by a congested router. Now all three responses stall — even though two of them have all their bytes sitting in a buffer, ready to deliver. QUIC was built to make this impossible.

Head-of-line blocking in TCP

TCP delivers all bytes in a single ordered stream. If packet N is lost, all bytes after it — in every logical message — wait for packet N to be retransmitted before the receiver’s application can process them.

HTTP/2 multiplexes request-response pairs over one TCP connection. When TCP drops a packet, every HTTP/2 stream stalls — even those whose data arrived intact. This is connection-level head-of-line blocking.

Numbers: At 0.5% random loss and 100 ms RTT, a message blocked in TCP’s ordered delivery waits ~230 ms. QUIC reduces this to ~0.4 ms — a 575× improvement.

QUIC streams are independent

QUIC multiplexes many bidirectional and unidirectional streams over a single connection. Each stream has:

  • Its own flow-control window (max-stream-data frame).
  • Its own application-level framing (STREAM frames, each stamped with a stream ID and offset).
  • Independent loss detection — a STREAM frame retransmit only affects its stream.

When a STREAM frame carrying stream 7’s data is lost, only stream 7’s receiver has to wait for the retransmit; streams 1, 3, and 5 keep flowing with new data.

Stream independence on packet loss
Packet
Stream 0 (video)
Stream 1 (chat)
Stream 2 (analytics)
pkt #1
delivered
delivered
delivered
pkt #2
LOST
delivered
delivered
pkt #3
waiting…
delivered
delivered
pkt #4 (retx)
recovered
delivered
delivered
Only stream 0 (video) waits for the retransmit. Chat and analytics continue unaffected.

Stream ID allocation

Stream IDs encode initiator and direction in the two lowest bits:

  • Client-initiated bidirectional: 0, 4, 8, 12, … (last 2 bits = 00)
  • Server-initiated bidirectional: 1, 5, 9, 13, … (last 2 bits = 01)
  • Client-initiated unidirectional: 2, 6, 10, 14, … (last 2 bits = 10)
  • Server-initiated unidirectional: 3, 7, 11, 15, … (last 2 bits = 11)

In HTTP/3, each HTTP request-response is one client-initiated bidirectional stream (IDs 0, 4, 8…). This encoding lets both sides allocate IDs independently without coordination.

Stream ID allocation in QUIC

1/3
Quiz

In QUIC, if a packet carrying stream 5 data is lost, what happens to stream 3?

Complete the analogy

QUIC's head-of-line-blocking fix is like a _______ where each stream has its own lane, so losing one packet in one lane does not freeze the entire highway.

Head-of-line blocking: TCP vs QUIC
TCP message blocking at 0.5% loss, 100 ms RTT
~230 ms
QUIC per-stream blocking (same conditions)
~0.4 ms
Improvement factor
575×
Page load on lossy mobile (HTTP/3 vs HTTP/2)
30–55% faster
Recall before you leave
  1. 01
    Explain the head-of-line blocking problem in TCP and how QUIC solves it with concrete numbers.
  2. 02
    What do the two lowest bits of a QUIC stream ID encode?
  3. 03
    Why does HTTP/2 over TCP still suffer from HoL blocking despite HTTP/2 multiplexing?
Recap

TCP’s single ordered byte stream means one dropped packet stalls every logical message sharing that connection — connection-level head-of-line blocking. HTTP/2 multiplexing does not help because TCP is still underneath. QUIC assigns each logical message its own stream with its own flow-control window and independent retransmit logic. A lost packet triggers a retransmit only for that stream; all others keep flowing. At 0.5% loss and 100 ms RTT the improvement is 575x: ~230 ms TCP blocking vs. ~0.4 ms QUIC per-stream stall. Stream IDs encode initiator and directionality in the two low bits, so client and server allocate IDs without coordination.

Connected lessons
appears again in165
Continue the climb ↑Integrated handshake and 1-RTT
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.