The mismatch problem
When a producer emits faster than a consumer can handle, items pile up. Backpressure strategies decide what to do with the surplus rather than letting memory grow without bound.
The main strategies
- Buffer stores excess items until the consumer catches up, bounded to avoid blowup.
- Drop discards new items when the buffer is full.
- Latest keeps only the most recent item and overwrites older ones.
- Error signals failure when demand is exceeded.
Buffering trades memory for completeness. Dropping and latest trade completeness for bounded resource use, which suits sensor data where stale readings are worthless.
Combining with demand
These strategies sit on top of the request protocol. Even with demand based flow, an operator may emit eagerly, so you place a backpressure operator to bridge a pushy source to a pull based consumer.
Key idea
Backpressure strategies buffer, drop, keep latest, or error to bound resource use when a producer outpaces its consumer.