Archivenetworking
Backpressure Is a Protocol, Not a Queue Size
When producers outrun consumers, the only choices are drop, buffer, or slow down. Pick deliberately.
- Published
- Reading time
- 1 min read
Every system has a finite service rate. If arrivals exceed it, queues grow until memory or latency explodes. Backpressure is the mechanism that tells producers to slow down before that happens.
Three responses
- Buffer: absorb bursts. Works until the queue becomes the latency; an unbounded queue is a memory leak with extra steps.
- Drop: shed load. Correct for real-time systems where stale work is worthless (video, metrics).
- Block/signal: apply backpressure to the producer. Correct for pipelines that must not lose work.
Implementing it
- Bounded queues with a rejection policy (
block,drop-oldest,fail-fast). - Flow control at the protocol level: TCP windows, HTTP/2
WINDOW_UPDATE, gRPC streaming credits. - Concurrency limits per downstream dependency, not just per instance.
The anti-pattern
An unbounded in-memory queue in front of a slow database. Under load, latency grows without bound and the process eventually dies — often taking the healthy requests with it.
Takeaway: decide what to drop and where. A system without an explicit shedding policy has an implicit one: collapse.