- Guides
- System patterns
System patterns
Patterns for services in production: resilience, data, messaging and scale. They are the building blocks of a strong system design answer.
19 guides3 groups375 min in total
Resilience
Patterns that keep a service standing when its dependencies fail, slow down or get more traffic than they can take.
About this group0 of 6 read- 1Circuit breaker: fail fast when a dependency is down11 min
- 2Retry with Backoff: Exponential Delays, Jitter and Retry Budgets20 min
- 3Timeouts and Deadline Propagation19 min
- 4Bulkhead: Isolate Resources So One Failure Stays Contained19 min
- 5Rate Limiting: Token Bucket, Sliding Window and Honest 429s22 min
- 6Idempotency Keys: Making Retried Writes Safe19 min
Data
Patterns for storing, splitting, reading and propagating data when a single database is no longer enough.
About this group0 of 8 read- 1Transactional Outbox: Commit State and Events Together20 min
- 2CQRS: Separate Write and Read Models with Projections21 min
- 3Event Sourcing: Store What Happened, Derive What Is22 min
- 4Sharding: Splitting Data Across Nodes by Key20 min
- 5Consistent Hashing: Adding Cache Nodes Without a Miss Storm19 min
- 6Cache-Aside: Invalidation, Stampedes, TTLs and Stale Reads22 min
- 7Read Replicas: Scaling Reads Without Serving Stale Writes21 min
- 8Change Data Capture: Stream Database Changes from the Log21 min
Messaging and scale
Patterns for coordinating services through messages and spreading the work when load goes up.
About this group0 of 5 read- 1Saga: Multi-Service Transactions with Compensations21 min
- 2Queue-Based Load Leveling: Absorbing a Refund Burst20 min
- 3Competing Consumers: Many Workers, One Queue, No Duplicates21 min
- 4Backpressure: Let Slow Consumers Slow Down Fast Producers18 min
- 5DataLoader Batching: Collapse N+1 Lookups Into One Call per Request19 min
About this section
- What these guides are
- Each guide describes a proven solution to a problem that appears when a system grows or depends on others. In a design interview you're expected to bring it up at the right moment and explain what you gain, what you lose and how it fails. These guides teach you all three.
- How they are organised
- The patterns are grouped by the problem they tackle: surviving failures, handling data at scale and coordinating services through messages. Many combine across groups, such as retries with idempotency keys or an outbox with queues.
- 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.
- Where to start
- Start with timeouts, retries with backoff and circuit breaker: they come up in almost every design. Then move on to cache-aside and transactional outbox.