Patterns
35 items
35 items
Flow control when downstream is overwhelmed
Backpressure is a mechanism where a system under load signals upstream to slow down, preventing overwhelming and cascading failures. When a service cannot process requests as fast as they arrive, instead of accepting and dropping (load shedding) or buffering unboundedly (OOM), it pushes back on senders. This can be explicit (429 responses, NACK) or implicit (slow responses cause caller timeouts). Backpressure is essential for reactive systems, stream processing, and any producer-consumer scenario where production can outpace consumption.
Without backpressure, slow consumer + fast producer = unbounded queue = OOM crash. Backpressure bounds the queue by slowing producers.
Service A slows down, A applies backpressure to B, B applies to C. Propagates to source. Whole system finds sustainable rate.
Explicit: NACK, 429, flow control frames. Implicit: Slow responses cause timeouts upstream, effectively slowing callers.
Backpressure Strategies:
With backpressure, system degrades gracefully under load. Without it, system crashes or loses data. Quality drops but system survives.
Backpressure Strategies:
| Aspect | Advantage | Disadvantage |
|---|---|---|