Skip to content

CONCEPT Cited by 1 source

Head-of-line blocking

Definition

Head-of-line (HOL) blocking occurs when a slow item at the front of an ordered queue or stream prevents subsequent items from being processed, even though those items could be handled independently. The "head" blocks the entire "line."

The concept appears across multiple system layers:

  • Networking (HTTP/1.1) — a slow response on a TCP connection blocks all pipelined requests behind it.
  • HTTP/2 over TCP — packet loss on the single TCP stream blocks all multiplexed streams (motivating QUIC/HTTP/3).
  • Message queues (Kafka) — within a single partition, a slow-to-process message blocks the consumer from advancing to subsequent messages (since offset commit is sequential).

In Kafka / ordered-partition systems

Kafka guarantees in-order consumption within a partition. If message M₁ takes 5 minutes to process and M₂…M₁₀₀₀ take milliseconds, the consumer cannot advance past M₁ until it completes. This is HOL blocking at the application layer.

Mitigation strategies: - patterns/fast-lane-slow-lane-consumer-split — split into two consumer groups; the fast one skips slow messages. - patterns/batch-goroutine-parallel-consumption — consume a batch and process concurrently, committing only when the full batch completes. - Add more partitions (increases broker resource usage; last resort).

Seen in

Last updated · 542 distilled / 1,571 read