- System patterns
- Messaging and scale
Messaging and scale
Patterns for coordinating services through messages and spreading the work when load goes up.
5 guides99 min in totalSystem patterns
The guides, in order
Read them top to bottom: each one builds on the ones before. The ones you've read carry a check.
- Saga: Multi-Service Transactions with CompensationsHow to run a long business transaction across services with local steps and compensating actions, and when to choose orchestration over choreography.21 min readStart here
- Queue-Based Load Leveling: Absorbing a Refund BurstHow a queue between bursty producers and a rate-paced consumer protects a fragile downstream, with a ferry refund outage as the worked example.20 min read
- Competing Consumers: Many Workers, One Queue, No DuplicatesHow to run several workers on one queue while handling ordering, visibility timeouts and poison messages, using a month-end invoice rendering backlog as the example.21 min read
- Backpressure: Let Slow Consumers Slow Down Fast ProducersHow bounded buffers, watermarks and explicit rejection let a slow downstream push back on fast producers instead of buffering until something crashes.18 min read
- DataLoader Batching: Collapse N+1 Lookups Into One Call per RequestHow per-request batching and caching turns hundreds of per-item lookups into a few bulk calls, with code, trade-offs and interview answers.19 min read
About this group
- What you'll find
- Sagas with compensations, queues to absorb bursts, competing consumers, backpressure and DataLoader for the N+1 problem.
- It's for you if…
- your design spans several services or gets load spikes and you need to explain how the work is shared out.
- How each guide works
- Each guide explains the problem, the solution and an analogy, with a diagram, pseudocode and code in TypeScript, Python and PHP. It also covers when to apply it, its trade-offs, how it fails and how to mitigate that, and when and how to bring it up in an interview.