Streaming systems fail in two ways: producer outpaces consumer (memory blows up) or consumer outpaces producer (idle waste). Backpressure is the protocol-level mechanism that tells producers to slow down — and getting it right is one of the hardest distributed systems problems in practice.

Advertisement

HTTP/2 and gRPC flow control

Window-based: receiver advertises 'I have X bytes of buffer space'. Sender stops when window exhausted. Receiver sends WINDOW_UPDATE as it consumes. Per-stream and per-connection windows.

Reactive streams (Project Reactor, RxJava)

Request(N) signals propagated upstream. Producer emits at most N items, waits for next request(N). Composes naturally through pipelines. Underpins Spring WebFlux, Akka Streams.

Advertisement

Lossy backpressure

When you can't slow producer (it's external), drop. Newest-wins (replace stale data: metrics, position updates). Oldest-wins (process arrival order: events). Sampling (1-in-N). Document the policy — silent drops are bad UX.

Window-based for protocol bidi, reactive streams for app pipelines, explicit drop policies when sources are external.