✏️ Explanatory Question

What is backpressure and why is it important for throughput?

👁 5 Views
📘 Detailed Answer
🟢 Easy
No previous question
No next question
💡

Answer with Explanation

Backpressure is a system signalling upstream that it cannot accept more work. Without it, a fast producer overwhelms a slow consumer until memory is exhausted and the whole thing collapses.

What happens without it: queues grow unbounded, latency rises until every response is past its timeout, so clients retry and add even more load, and the system does maximum work while completing zero useful requests - congestion collapse.

Mechanisms:

  • Bounded queues - fixed capacity, then reject or block. Never use an unbounded queue in production.
  • Rate limiting - token bucket at the edge, returning 429 with Retry-After.
  • Load shedding - drop low priority work first to protect the critical path.
  • TCP flow control and reactive streams - the consumer requests N items, so the producer cannot outpace it.
  • Concurrency limits - semaphores or adaptive limits (AIMD) that shrink under stress.

The counterintuitive point: rejecting some requests early increases useful throughput, because work that will time out anyway is wasted capacity. Failing fast is better than failing slowly.

No previous question
No next question