What is back-pressure in distributed systems?
Answer
Back-pressure is a flow control mechanism where a slower consumer signals an upstream producer to slow down, preventing the consumer from being overwhelmed and crashing. Without back-pressure, a fast producer overwhelming a slow consumer causes memory exhaustion, request queuing, and eventual failure. Analogies: a garden hose nozzle controlling water flow; car traffic congestion spreading back from a bottleneck. Strategies: (1) Blocking/synchronous back-pressure: the producer waits until the consumer is ready — simple but creates tighter coupling (TCP flow control window is an example); (2) Message queue with bounded queue: if the queue is full, the producer blocks or drops/rejects messages — the queue acts as a buffer with a capacity limit; (3) Rate limiting upstream: signal the producer via HTTP 429 (rate limit) or queue depth metrics to reduce throughput; (4) Load shedding: when overwhelmed, drop non-critical requests rather than crashing; (5) Reactive Streams: a standard for async stream processing with non-blocking back-pressure (Java: Project Reactor, RxJava; implemented in Akka Streams). In practice: Kafka consumers control their read rate independently; Node.js streams have pause()/resume() for back-pressure. Back-pressure is a fundamental concept in designing resilient data pipelines, streaming systems, and microservices under variable load.
Previous
What is service discovery?
Next
What is the difference between push and pull architectures?