Messagingflow control

Backpressure

Definition

Backpressure is any mechanism by which a consumer limits the rate at which a producer sends work, such as bounded queues, blocking writes, credit windows or explicit rejections.

In practice

When producers outpace consumers, unbounded buffers grow until memory runs out or latency becomes useless. Bounding the buffer forces a choice: block the producer, reject new work (load shedding), or drop the least valuable items.

Backpressure has to propagate end to end; a bounded queue in the middle only moves the pile-up elsewhere. Returning 429 or 503 to clients is backpressure at the edge, and TCP flow control is backpressure in the network stack.

Example

An ingestion service accepts events into a bounded queue of 10,000; when it is full, it returns 503 with Retry-After, so clients slow down instead of the service crashing.