The ideas behind every box
Start with the fundamentals: one article per building block you place in the game. Then see how they combine in full case studies, and how to write the code in a low-level design round.
Fundamentals
The building blocks you place in the game, in the order the levels need them.
- 01
Back-of-the-envelope estimation
Level 1, 2, 7Before you draw a single box, work out how much traffic, data and bandwidth you are designing for.
- 02
Load balancing and horizontal scaling
Level 2, 11Add machines instead of buying bigger ones, and put something in front that spreads the work and routes around failures.
- 03
Caching
Level 3, 4, 7, 11, 12Keep the answers to popular questions in memory so the database only sees the questions nobody asked recently.
- 04
Database indexing
Level 3Before you buy another database, make each query touch fewer rows. Indexes are the cheapest scaling you'll ever do.
- 05
SQL vs NoSQL
Level 12Choose a database by its data model and access patterns. The label on the box matters much less.
- 06
Database replication
Level 3, 5, 11Copies of your database give you more read capacity and a standby for when the primary dies. They cost consistency.
- 07
CDNs and edge caching
Level 6, 12You can't make light faster, but you can shorten the distance by serving bytes from a city near each user.
- 08
Message queues and backpressure
Level 7, 9, 10Accept work now, do it at a pace you can sustain, and make sure you eventually catch up.
- 09
Rate limiting
Level 8Decide how much each client may ask for, and say no early and cheaply when they ask for more.
- 10
Availability, redundancy and failover
Level 11, 2Every component fails eventually. Design so that one failure costs you capacity, not the whole site.
- 11
Sharding and consistent hashing
Level 12, 13When one primary can't absorb your writes, split the data so each database owns a slice.
High-level design
High-level design case studies. Each one combines the fundamentals into a full system.
- 12
URL shortener and ID generation
A tiny product with a real design question: how do you hand out billions of short, unique keys without a bottleneck?
- 13
News feed and fan-out
Level 14, 13Precompute every user's feed when someone posts, or assemble it when they open the app? The answer is both.
- 14
Notification service
Level 9Deliver each message once, on the right channel, at the right time, even though every provider and network in the path can fail.
- 15
Chat systems and real-time connections
Millions of open connections, messages that must arrive in order, and users who are offline half the time.
- 16
Monitoring and alerting systems
Level 15Take in a flood of alerts without dropping one, collapse them into incidents a person can act on, and keep working when everything else is on fire.
- 17
Running a design interview
A system design round is graded on how you get to an answer. Here's a sequence and a clock that keep you in control.
Low-level design
Low-level design: object models, design patterns and working Java code you can write in 90 minutes.
- 18
SOLID and the six patterns worth knowing
Principles that keep classes easy to change, and the handful of patterns that come up in almost every low-level design round.
- 19
Coding an LRU cache and a rate limiter
Two classics you should be able to write from memory in Java: O(1) LRU eviction and a thread-safe token bucket, with tests.
- 20
Parking lot in 90 minutes
The classic LLD problem: clarify, model the entities, leave an extension point, and handle two cars racing for the last spot.
- 21
Splitwise: expenses, splits and settling up
Model shared expenses so equal, exact and percentage splits share one code path, then settle the group in as few payments as practical.
- 22
Elevator system: state machine and scheduling
Model each car as a state machine that refuses illegal moves, and keep the dispatch policy swappable.