Skip to content
Library/Core Concepts
Bottleneck analysis

Queue Saturation & Backpressure

2 min read

When consumers fall behind producers, queues grow unbounded — and then everything crashes at once.

When consumers fall behind producers, queues grow unbounded — and then everything crashes at once.

How It Works

A message queue (see Queues for the underlying decoupling pattern — think Kafka, RabbitMQ, SQS) acts as a shock absorber, not an infinite well. When the rate of producers exceeds the rate of consumers over time, the queue grows until something gives: the broker runs out of memory and crashes (OOM, out-of-memory error), messages start getting dropped, or upstream services block waiting for their messages to be accepted. Warning signs: growing queue lag, rising broker memory, and consumer offset drift (consumers reading from a point far behind the producer's latest write). The fix is not bigger queues — it is backpressure: consumers signal upstream "I am falling behind, slow down your input," usually via bounded-size queues, rate limits at the ingress, or explicit flow-control protocols.

Real-World Example

Uber's 2016 surge outage started with a traffic spike that overwhelmed their matching service queue. Without backpressure, the queue grew until the Kafka brokers ran out of memory, which cascaded into the dispatcher service going down. Now they rate-limit at the API gateway with adaptive thresholds — when downstream queue depth exceeds a high-water mark, the gateway starts rejecting requests with 503 errors before the queue can saturate.

Test Yourself

Scenario: An order processing pipeline writes to a Kafka topic at 50,000 msgs/sec. Consumer lag (the offset gap between the producer's latest write and the consumer's current read position) was steady at ~2s for weeks, then yesterday started climbing: 10s, 1min, 15min, and broker memory is now at 85%. Diagnose and name the fix.

Get notified when we launch

One email when the full practice product is live. No spam.