SystemExpertsSystemExperts
Pricing

Patterns

35 items

Horizontal Scaling Pattern

15mbeginner

Retry with Backoff Pattern

15mbeginner

Replication Pattern

25mintermediate

Caching Strategies Pattern

25mintermediate

Persistent Connections Pattern

20mintermediate

Load Balancing Pattern

20mintermediate

Fan-out Pattern

20mintermediate

Fan-in Pattern

20mintermediate

Circuit Breaker Pattern

20mintermediate

Eventual Consistency Pattern

25mintermediate

Queue-based Load Leveling Pattern

20mintermediate

Bloom Filters Pattern

20mintermediate

Time-Series Storage Pattern

20mintermediate

Bulkhead Pattern

20mintermediate

Batch Processing Pattern

20mintermediate

Write-Ahead Log Pattern

20mintermediate

API Gateway Pattern

20mintermediate

Backend for Frontend Pattern

20mintermediate

Sidecar Pattern

20mintermediate

Idempotency Pattern

20mintermediate

Rate Limiting Pattern

20mintermediate

Backpressure Pattern

20mintermediate

Pub/Sub Pattern

25mintermediate

Strong Consistency Pattern

30madvanced

Conflict Resolution Pattern

25madvanced

Leader Election Pattern

25madvanced

Consensus Protocols Pattern

30madvanced

CQRS Pattern

28madvanced

LSM Trees Pattern

25madvanced

Sharding Pattern

25madvanced

Event Sourcing Pattern

30madvanced

Stream Processing Pattern

25madvanced

Change Data Capture Pattern

25madvanced

Distributed Locking Pattern

25madvanced

Two-Phase Commit Pattern

25madvanced
System Design Pattern
Rate Managementbackpressureflow-controlreactiveproducer-consumeroverflowintermediate

Backpressure Pattern

Flow control when downstream is overwhelmed

Used in: Stream Processing, Message Queues, Reactive Systems|20 min read

Summary

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.

Key Takeaways

Alternative to Unbounded Buffering

Without backpressure, slow consumer + fast producer = unbounded queue = OOM crash. Backpressure bounds the queue by slowing producers.

Propagates Through System

Service A slows down, A applies backpressure to B, B applies to C. Propagates to source. Whole system finds sustainable rate.

Explicit vs Implicit

Explicit: NACK, 429, flow control frames. Implicit: Slow responses cause timeouts upstream, effectively slowing callers.

Backpressure Propagation

Backpressure Strategies:

  1. Block: Producer blocks until consumer ready (sync systems)
  2. Drop oldest: Discard old items, keep new (real-time systems)
  3. Drop newest: Reject new items, keep buffer (batch systems)
  4. Signal and retry: Return 429, client retries with backoff
  5. Adaptive rate: Dynamically adjust producer rate

Summary

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.

Key Takeaways

Alternative to Unbounded Buffering

Without backpressure, slow consumer + fast producer = unbounded queue = OOM crash. Backpressure bounds the queue by slowing producers.

Propagates Through System

Service A slows down, A applies backpressure to B, B applies to C. Propagates to source. Whole system finds sustainable rate.

Explicit vs Implicit

Explicit: NACK, 429, flow control frames. Implicit: Slow responses cause timeouts upstream, effectively slowing callers.

Reactive Streams

Reactive Streams spec (Java, JS, etc.) builds in backpressure. Subscriber requests N items, publisher sends only N. Built-in flow control.

TCP Has Backpressure

TCP flow control is backpressure - receiver advertises window, sender respects it. But application-level backpressure often needed too.

Premium Content

Sign in to access this content or upgrade for full access.

Graceful Degradation

With backpressure, system degrades gracefully under load. Without it, system crashes or loses data. Quality drops but system survives.

Pattern Details

Backpressure Propagation

Backpressure Strategies:

  1. Block: Producer blocks until consumer ready (sync systems)
  2. Drop oldest: Discard old items, keep new (real-time systems)
  3. Drop newest: Reject new items, keep buffer (batch systems)
  4. Signal and retry: Return 429, client retries with backoff
  5. Adaptive rate: Dynamically adjust producer rate

Trade-offs

AspectAdvantageDisadvantage