← Concepts

阅读中文版本

Backpressure Service Design

Backpressure service design makes a service propagate overload upstream rather than queue unboundedly, so the system degrades by shedding load instead of piling latency until everything collapses.

architecture

Definition

Backpressure service design is the architectural choice where a service, when overloaded, signals its callers to slow down — through reactive streams, HTTP 429, or TCP flow control — so that load is shed at the source rather than queued at the bottleneck, preserving the fast path and bounding latency under stress.

Context and scope

Applied in streaming pipelines, API gateways, and any service where unbounded queuing turns a slow downstream into a memory-exhausting, latency-exploding cascade.

Common misconceptions

  • Backpressure is just rate limiting — rate limiting shed load at the edge; backpressure propagates the signal to the source so the source slows, not just gets rejected
  • A bounded queue is backpressure — a bounded queue drops or blocks; true backpressure communicates the pressure so the source reduces its rate

Anti-patterns

  • Using an unbounded queue that hides overload until OOM, instead of a bounded queue that applies backpressure
  • Returning 429 without a Retry-After, so the client retries immediately and amplifies the load

Related concepts

Authoritative source

https://www.reactivemanifesto.org/glossary#Backpressure

What it is

Backpressure service design is the architectural choice where a service, when overloaded, signals its callers to slow down — through reactive streams, HTTP 429, or TCP flow control — so that load is shed at the source rather than queued at the bottleneck, preserving the fast path and bounding latency under stress. Applied in streaming pipelines, API gateways, and any service where unbounded queuing turns a slow downstream into a memory-exhausting, latency-exploding cascade. The organizing principle is which decisions are hard to reverse and should be made once, versus which are easy to reverse and should be deferred.

How it works

Boundaries are drawn along axes of change: things that change together are colocated, things that change independently are separated by interfaces whose contracts are explicit and versioned. Dependencies point toward stability — domain logic depends on abstractions, infrastructure depends on domain, never the reverse. The structure makes the system’s intent legible without reading every module.

When to choose and pitfalls

Choose this structure when the system will outlive its first deployment and face requirements you cannot now predict. The pitfall is premature abstraction — adding indirection for a flexibility that never materializes, paying its complexity cost forever. The opposite pitfall is entangling concerns that later need to separate, forcing a rewrite instead of a refactor.