System Design
9. Message Queues and Event-Driven SystemsAnimated
Message Ordering
Keeping messages in order.
The idea
Queues can preserve order per partition or key but not globally at scale.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
A service publishes an event: "OrderPlaced".
- step:
- 1/4
- at:
- Producer
1/8
The green dot is a request moving through the system.
Step by step
- 1Assign a key
- 2Messages with the same key go to one partition
- 3Consumers read in order
- 4Parallelism comes from many keys
Where it is used
Account updates.
Watch out for
Global ordering limits throughput.