Why it matters

Missing backpressure is the top cause of streaming production incidents: memory grows, GC pressure spikes, servers fall over. Getting it right up front prevents these.

Advertisement

The architecture

Producer generates data faster than consumer can process. Without backpressure, buffer between them grows.

Backpressure mechanisms: bounded buffers (block on full), TCP window (built into TCP), reactive streams (Publisher/Subscriber contract), explicit rate limits.

Backpressure patternsFast producerno throttlingBounded bufferblock or dropSlow consumersignals capacityTCP window is built-in; higher layers need explicit mechanisms like reactive streams
Backpressure mechanisms.
Advertisement

How it works end to end

TCP: built-in via receive window. Sender pauses when window exhausted.

WebSocket: application-level; must implement bounded outbound queue.

gRPC: HTTP/2 has flow control per stream.

Reactive Streams (Java, JS): Publisher requests N items; Subscriber sends demand back.