liveBook · Manning

Backpressure

As explained in Latency

Backpressure is a flow-control technique that causes producers to reduce or pause transmission when consumers cannot process incoming data at the same rate.

Backpressure regulates asynchronous data flow by causing producers to slow or pause when consumers cannot process incoming work at the same rate. It stabilizes concurrency, protects resources, and keeps performance predictable. section 10.5

Figure 10.4 Backpressure controls the flow of work from producer to consumer to avoid overwhelming the consumer. Clients push work to a server, which buffers it. The service itself pulls work from the buffer. The service also signals the clients about the buffer capacity limits so that the clients know when to slow down to avoid overwhelming the system.
Figure 10.X: Backpressure controls the flow of work from producer to consumer to avoid overwhelming the consumer. Clients push work to a server, which buffers them. The service itself pulls work from the buffer. The service also signals to the clients of buffer capacity limits so that the clients know when to slow down to avoid overwhelming the system.

Clients push requests to a service buffer; the service pulls work for processing and signals remaining buffer capacity so clients can adjust their sending rate. section 10.5

Apply backpressure through several complementary controls:

  • Throttle producers when the consumer approaches capacity, propagating the signal to the layer best able to reduce work. section 10.5.1
  • Use a TCP transmission window or delay socket reads until processing capacity exists, allowing the receiver to regulate senders. section 10.5.1
  • Buffer work to absorb temporary load spikes, while sizing buffers against the trade-off between latency and dropped work. section 10.5.2
  • Rate-limit clients over a time window, and retain dropping as a last-resort safeguard when other controls fail. section 10.5.3

Rate-limited API service

An API server may permit 100 requests per second per client. Requests beyond the time-window limit produce errors or are dropped when the service is already at capacity; choosing the limit requires understanding system capacity and client concurrency. section 10.5.3

How Latency covers it

How deep it goes
Explains producer signaling, TCP receive windows, buffering, rate limits, dropping, and latency trade-offs without detailing a complete implementation.
Examples
Uses buffered client requests, TCP transmission windows, video-frame buffering, and 100-requests-per-second API limits.
What it assumes
Assumes familiarity with asynchronous processing, producers, consumers, queues, and client-server communication.
What you can do after
Operate/configure asynchronous services by throttling producers, sizing buffers, delaying reads, rate-limiting clients, and retaining overload safeguards.
How it connects
Connects asynchronous processing with concurrency, throttling, TCP transmission windows, buffering, rate limiting, and dropping.

Also explained in

Compare how 6 books explain backpressure →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.