recall

← recall

backpressure pattern

Slow consumers signal slow producers to ease off, so queues don't grow without bound. The push model becomes a pull model: producers only emit when consumers can accept.

Slow consumers signal slow producers to ease off, so queues don't grow without bound. The push model becomes a pull model: producers only emit when consumers can accept.

symptoms

  • unbounded queue growth
  • memory pressure as messages buffer
  • OOM kills on producers

causes

  • fire-and-forget pipelines without flow control
  • no signal back from consumer to producer
  • buffered channels with no size cap

fixes

  • bounded queues that block producers when full
  • reactive streams / TCP-style flow control
  • explicit consumer ack pacing
  • load shedding at the producer side

you might say

  • apply backpressure
  • the consumer can't keep up
  • block the producer

related

aliases: push back, flow control

topics: queueing, flow-control

references: