System Design
9. Message Queues and Event-Driven SystemsAnimated
Backpressure
Telling producers to slow down when consumers are overwhelmed.
The idea
Bounded buffers and signals protect systems from overload.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- allowed
- rejected
4 arrive, 3 are served. The queue holds 1.
- tick:
- 1
- allowed:
- 4
- rejected:
- 0
1/24
Bars show how many requests were let through each tick.
Step by step
- 1Queue fills
- 2Signal slow down or reject
- 3Producer reduces its rate
- 4System recovers
Where it is used
Streaming systems.
Watch out for
Unbounded queues hide the problem until memory runs out.