Skip to main content
networking

Backpressure

Backpressure is a flow control mechanism where a slow consumer signals the producer to slow down, preventing buffer overflow and data loss. TCP's receive window is backpressure. In streaming systems (Kafka, reactive streams), backpressure propagates upstream – if the database is slow, the entire pipeline slows instead of dropping data.

Definition

Backpressure propagates flow control signals from slow consumers upstream to fast producers. Without backpressure, a fast producer overwhelms a slow consumer – buffers fill, memory exhausts, and data is lost or the system crashes. TCP implements backpressure via the receive window: when the receiver's buffer is full, it advertises rwnd=0, pausing the sender. In reactive programming (Project Reactor, RxJava, Akka Streams), backpressure is a first-class concept – subscribers request N items at a time, and publishers respect the demand signal. In message queues: Kafka consumers with consumer lag apply backpressure by not committing offsets (messages remain available for reprocessing). RabbitMQ applies backpressure by blocking publishers when memory or disk thresholds are breached. The alternative to backpressure is dropping: UDP has no backpressure – overloaded receivers simply discard packets. Choose based on data value: financial transactions need backpressure (no loss), telemetry metrics can drop (latest value is sufficient).

Examples

  • TCP: rwnd=0 in ACK pauses the sender (kernel-level backpressure)
  • Reactor: Flux.create(sink -> {...}, FluxSink.OverflowStrategy.ERROR)
  • RabbitMQ: vm_memory_high_watermark = 0.4 (blocks publishers at 40% RAM)

Related Protocols

Related Terms