Backpressure
Backpressure
Bronze
When a consumer can't keep up, backpressure carries a "slow down" signal back to the producer — typically a bounded queue that refuses new work when it is full — instead of letting an unbounded queue grow its delay and memory without limit.
- Use when
- Any queue or buffer between parts that run at different speeds · Producers that can slow down, wait or retry later — batch jobs, streams, internal services
- Avoid when
- Work that must be accepted even if it waits — there, take the backlog and handle the most urgent first
- Trade-offs
- Bounds memory and delay, but the producer has to handle refusals · A queue shared by several producers pushes back on all of them, including the ones not causing the backlog
- Requires
- Async work with a queue, Load shedding
3 objectives · 8 misconceptions
- explain Explain how a bounded queue that refuses new work when full tells producers to slow down, and why an unbounded queue only hides the problem.
- predict Predict queue depth and waiting time when producers outpace the consumer, with an unbounded queue and with a bounded one.
- choose Choose what a full queue does — refuse the new item, drop it, or drop the oldest — for a given kind of work.
- Not true: An unbounded queue is the safest choice, because it never turns work away.
- Not true: A bigger buffer fixes a consumer that can't keep up.
- Not true: Backpressure means throwing data away when the queue is full.
- Not true: Once the consumer recovers, the backlog clears quickly.
- Not true: Backpressure lets the slow consumer handle more work.
- Not true: When a full queue has to drop work, it makes no difference whether it drops the newest items or the oldest.
- Not true: A service should absorb a downstream "slow down" itself, by retrying quietly, rather than pass it on to its callers.
- Not true: Every system should refuse new work as soon as its queue fills.
Learn
Backpressure — a queue that says noMembers~11 minPractice
No katas practice this yet.
Check
Station test-out80% to passNeighborhood
contrast withLoad leveling