Head-of-line blocking

On this page 7

Head-of-line blocking is the performance problem in which the first item in an ordered queue cannot be processed, so every item behind it must wait even when those later items are complete and ready. Among transport protocols in networking, the term most often describes how a single lost TCP segment stalls delivery of all subsequent bytes to the application until the missing segment is retransmitted.

The effect matters because it turns an isolated packet loss into a delay for unrelated data. When several independent streams share one ordered channel, a loss that affects one stream freezes all of them. This is the main reason why HTTP/2 over TCP can underperform on lossy links and why QUIC and SCTP were designed with independent streams.

How head-of-line blocking arises in an ordered byte stream

Head-of-line blocking arises whenever a protocol guarantees strict in-order delivery over a channel that can lose or reorder packets. TCP presents the application with a single continuous byte stream, so the receiver may hand bytes to the socket only in sequence-number order.

When segment N is lost but segments N+1 through N+20 arrive, the receiver stores them in its out-of-order reassembly buffer. The application sees nothing new until segment N is recovered. Recovery takes at least one additional round-trip time with fast retransmit, and much longer if the sender must wait for a retransmission timeout (RTO), which commonly starts at 200 ms to 1 s depending on the operating system.

The same pattern exists at other layers. A switch with a single first-in, first-out input queue suffers head-of-line blocking when the frame at the front waits for a congested output port while frames for idle ports sit behind it. HTTP/1.1 pipelining shows it at the application layer, because responses must return in request order.

The following table summarizes where the phenomenon appears and what is blocked at each layer.

LayerOrdered unitWhat causes the stallWhat waits
Switch fabricFrames in an input queueBusy output portFrames for idle ports
TCP transportBytes in one connectionLost or delayed segmentAll later bytes
HTTP/1.1 pipeliningResponses on one connectionSlow first responseLater responses
HTTP/2 over TCPFrames of many streamsAny TCP segment lossEvery multiplexed stream
TLS recordsEncrypted recordsIncomplete recordData in the record
Where head-of-line blocking occurs

Transport-layer and application-layer variants

Practitioners distinguish transport-layer head-of-line blocking from application-layer head-of-line blocking, because the fixes differ. HTTP/2 removed the application-layer form by multiplexing many streams over one connection with interleaved frames, yet it kept the transport-layer form because all those streams still ride on one TCP byte stream.

The irony is well known: on a clean network HTTP/2 is faster than HTTP/1.1 with six parallel connections, but at packet loss rates of roughly 1-2 percent and above, the single connection can perform worse. Six separate TCP connections lose independently, whereas one shared connection stalls every stream at once. The exact crossover depends on round-trip time, congestion control and page composition.

The table below compares how common protocols handle ordering and whether streams can block one another.

ProtocolDelivery guaranteeIndependent streamsCross-stream blocking
TCPReliable, orderedNoYes, one stream only
UDPUnreliable, unorderedNot applicableNo
SCTPReliable, ordered per streamYesNo
QUICReliable, ordered per streamYesNo
HTTP/2 over TCPOrdered per stream at applicationLogical onlyYes, through TCP
HTTP/3 over QUICOrdered per streamYesNo for data
Ordering behavior of common protocols

How QUIC, SCTP and other designs remove the stall

The general remedy is to scope ordering to the smallest unit that actually needs it. QUIC, standardized in RFC 9000, runs over UDP and tracks byte offsets per stream, so a lost packet delays only the streams whose frames it carried. Other streams continue delivering data to the application without waiting.

SCTP achieves a similar result with multi-streaming inside one association, and it also supports unordered delivery for messages that tolerate reordering. Switch designers solve the hardware form with virtual output queues, which keep a separate queue per output port at each input.

Some residual blocking remains even in modern designs. HTTP/3 header compression with QPACK was specifically designed to limit header dependencies across streams, because its predecessor HPACK would have reintroduced cross-stream blocking. A single stream that carries a large response is still ordered internally, so loss within that stream still delays its own later bytes.

The next table lists mitigation techniques and their trade-offs.

TechniqueHow it helpsTrade-off
Multiple TCP connectionsIsolates loss per connectionMore handshakes, unfair congestion share
QUIC streamsPer-stream orderingUser-space stack, higher CPU cost
SCTP multi-streamingPer-stream orderingPoor traversal of NAT and firewalls
Selective acknowledgmentFaster loss recoveryShortens but does not remove stalls
Virtual output queuesRemoves switch input blockingMore buffer memory and scheduling logic
Unordered deliveryNo waiting at allApplication must reorder or tolerate gaps
Mitigation techniques and their costs

Measuring the impact on latency

The cost of head-of-line blocking is visible as latency spikes rather than lower throughput. Average throughput may look healthy while the tail of the latency distribution, such as the 99th percentile, grows sharply because each loss event freezes delivery for one or more round trips.

Engineers detect it by correlating retransmission events with application stalls in a packet capture, or by watching the size of the receive-side reassembly queue. Interactive traffic suffers most: remote desktop sessions, multiplayer games, real-time telemetry and web pages composed of many small resources.

  • Bulk transfers barely notice the problem, because they need every byte anyway.
  • Interactive and multiplexed traffic suffers most, because unrelated messages wait for one loss.
  • High round-trip time amplifies the stall, since recovery takes at least one round trip.
  • Wireless and mobile links show the effect strongly due to bursty loss.

Common misconceptions and design mistakes

A frequent misconception is that HTTP/2 eliminated head-of-line blocking. It removed only the application-layer form; the transport-layer form remains whenever HTTP/2 runs over TCP. Another error is assuming that larger windows or faster links fix the problem, whereas the stall depends on loss and round-trip time, not on bandwidth.

Designers also sometimes switch to raw UDP to avoid blocking, then rebuild reliable ordered delivery on top of it and reintroduce the same issue. The decisive question is whether messages are truly independent. If they are, ordering should be per message or per stream; if they are not, blocking is the correct behavior and not a defect.

A plain-language summary

Head-of-line blocking is like a single checkout lane in a shop. If the first customer has a problem with a payment, everyone behind waits, even people buying one item who could leave in seconds.

On a network, data often travels in a line that must be handed over in exact order. When one piece goes missing, all the pieces behind it wait until it is sent again. The fix is to open separate lanes, so a problem in one lane does not stop the others.

An example from practice

A web team serves a product catalog page that loads about 80 images, scripts and style files over HTTP/2. Office users on wired connections see fast loads, but customers on congested mobile networks report pages that freeze for half a second and then fill in all at once.

Packet captures show 1.5 percent packet loss and a round-trip time near 120 ms. Each lost TCP segment holds back every multiplexed stream on the single connection until retransmission completes. The team enables HTTP/3 over QUIC on its content delivery edge while keeping HTTP/2 as a fallback.

After the change, mobile users with QUIC see the 95th-percentile page load time drop by roughly a fifth, because a lost packet now delays only the image it carried. Wired users see little difference, which confirms that the gain came from removing transport-layer head-of-line blocking rather than from raw speed.