The problem atlas: classic designs decomposed
Familiar design problems placed by their invariant, their dominant ratio and their scarce resource, and mapped to the chapters that make each one hard.
This chapter lets you take a design problem you have not seen before and place it quickly: which of this pathway’s chapters make it hard, which barely matter, and what the first three questions about it should be. It does this for the problems that come up most often in interviews and in industry writing, and it uses Dabba as the reference point for each.
The atlas is not a set of answers to memorise. Each problem below has a familiar shape, and most published solutions share that shape, but the right design for a given team still comes from its requirements and numbers. What transfers between problems is the classification: knowing that a payments ledger is a problem about writes that must never be wrong, and a news feed is a problem about reads that may be a little stale, tells you where to spend the hour.
Three questions that place a problem on the map
Dabba’s chapters were driven by three questions, asked again and again. They work for any problem.
What must never be wrong? For Dabba it was “one order, one rider” and “never charge twice”. The invariant decides where strong consistency, conditional writes and idempotency are needed, and by elimination, where staleness is acceptable. A design with no stated invariant usually has an accidental one.
What is the dominant ratio? Reads to writes, writes to readers (fan-out), or events to state. Dabba’s menus were read thousands of times per edit; its rider locations were written 10,000 times a second and read only to answer “who is near?”. The ratio decides whether the design is built around caches, around fan-out, or around a write path.
What is scarce, and where is the hottest key? For Dabba the scarce thing was riders at the dinner peak, not machines. In other problems it is a celebrity’s followers, a popular link, a single account receiving thousands of payments a second. The scarce thing is where queues form, and where rate limits, shedding and partitioning choices matter.
Before reading the section on ledgers: which of this pathway’s chapters does a payments ledger lean on most, and which could it almost ignore?
Show the worked answer
It leans hardest on getting writes right (transactions, isolation, invariants such as “every entry balances”), on background work (idempotent effects, reconciliation jobs, exactly-once effect rather than delivery), on security (who may move money, webhook verification, audit) and on IDs (stable references shared with banks and providers). Delivery matters more than usual, because a bad deploy can corrupt money, not just serve an error.
It can almost ignore the edge and CDN chapter, geospatial indexing, blob storage and realtime push. A ledger’s read traffic is modest and its values are not cacheable in the usual sense, since a stale balance can authorise a payment that should be refused. If your first sketch of a ledger starts with a cache, the invariant has not been written down yet.
Problems that are mostly reads
URL shortener. Create a short code for a long URL; redirect anyone who visits the code. Redirects outnumber creations by a hundred to one or more, links almost never change, and a redirect should take tens of milliseconds. So the read path is a cache in front of a key-value lookup, and because codes are immutable, caching is easy and replication lag is harmless. The interesting parts are elsewhere: generating short codes without coordination (random codes with a uniqueness check, as in the IDs chapter; seven characters of base 62, letters and digits, give 62⁷, about 3.5 trillion codes, so collisions stay rare for a long time), keeping click analytics off the redirect path (emit an event, count downstream, as in the derived-data chapter), and abuse, because a free shortener becomes a tool for hiding phishing links (rate limits on creation, scanning targets before activation). Compared with Dabba, it is a menu page with no menu edits.
Search autocomplete. As a user types “bir”, suggest “biryani”, “biryani near me”, “Biryani Blues”. Every keystroke is a request, so the latency budget is tight (suggestions must appear within about 100 ms to feel attached to typing) and the request rate is several times the search rate. The standard design precomputes, for each prefix, the top few completions ranked by popularity, offline, from query logs: this is derived data, rebuilt hourly or daily. Counting popular queries over billions of log lines is a job for the sketches chapter (approximate heavy hitters). Short prefixes are few and very hot, so they are cached at the edge; long prefixes are many and cold, and are served from a prefix index sharded by prefix. Personalisation and freshness (a trending query today) are added as small overlays on the precomputed list, not by computing the list per request. Dabba’s own restaurant search would use exactly this, with the city as an extra key.
Problems that are mostly fan-out
News feed. When a user posts, their followers should see it in their feeds. The dominant ratio is fan-out: one write, many readers. Precomputing each follower’s feed at write time (push) makes reads cheap and writes expensive, and a user with 50 million followers makes a single post cost 50 million writes. Computing the feed at read time (pull) makes writes cheap and reads expensive, merging recent posts from hundreds of followees per page view. Published designs converge on a hybrid: push for ordinary accounts, pull for the few very large ones, merged at read time. The chapters that make it hard are scaling reads, sharding (by user, and the celebrity as a hot key), streams (fan-out as asynchronous work off a log) and derived data (the feed is a materialised view that can be rebuilt). Staleness of a few seconds is acceptable, which is why the design can be this asynchronous.
Notification system. Dabba built a small one in the background-work chapter; at platform scale it becomes a product of its own. Events (“order out for delivery”, “new message”, “price drop”) fan out to channels (push, SMS, email, in-app) according to user preferences, quiet hours and per-user frequency caps. The hard parts are the ones Dabba met: idempotent sending (a duplicated “your order is delivered” is annoying; a duplicated “₹5,000 debited” causes support calls), separate lanes so bulk marketing never delays a security code, per-provider rate limits and failover between SMS gateways, and collapsing (“3 new messages” rather than three pushes). Rate limiting and failure chapters matter as much as jobs; a notification system’s worst day is usually a provider outage combined with a marketing campaign.
Problems that are mostly ordering and connections
Chat. Users send messages in one-to-one and group conversations, and each participant sees them in the same order, in real time when online and on reconnect when not. The invariant is per-conversation order: messages in a conversation must not appear in different orders to different members. The usual answer is to route each conversation through one partition (or one sequencer) that assigns increasing sequence numbers, which the streams chapter and the IDs chapter both prepare for. Delivery uses the realtime chapter’s persistent connections, with each conversation’s messages routed through subscriptions on a pub/sub backbone, and falls back to push notifications when the user is offline. Receipts (“delivered”, “read”) are state transitions that may arrive twice and out of order, so they are stored as “highest sequence number read” per member, which is naturally idempotent. Large groups bring back fan-out, and end-to-end encryption moves much of the logic to clients. Dabba’s rider–customer chat is a small version: two members, a lifetime of one delivery.
Problems that are mostly contention
Ride matching. This is the worked chapter with the food removed. The geospatial index finds nearby drivers, the 10,000-pings-a-second shape is the same, and the core invariant (one ride, one driver; one driver, one ride) is defended with the same conditional writes on a store that holds driver state. The differences are instructive. The customer waits on the street rather than at home, so assignment latency matters more and offers may go to a few drivers at once. Pricing responds to supply and demand in each area in near real time (surge), which is a feedback loop on the “not enough riders” problem. And trips cross city boundaries more than food orders do, which complicates partitioning.
Payments ledger. Record every movement of money so that balances can be computed, audited and reconciled with banks. The invariant is absolute: every transaction is recorded as balanced entries (debits equal credits), entries are never edited or deleted (corrections are new entries), and the same instruction applied twice must not move money twice. Write volume is moderate for most companies; correctness is everything. That puts the weight on the writes chapter (serialisable transactions or carefully designed conditional writes per account), on idempotency keys shared with external parties, on reconciliation jobs that compare the ledger with bank and provider statements daily and raise every mismatch, and on security and audit. The hot key is a single very busy account (a merchant receiving thousands of payments a second), solved by splitting it into sub-accounts that are summed for reporting. Dabba’s payouts ledger from the background-work chapter is a small, honest example: a unique constraint per rider and period, and a bank reference that makes the unknown outcome recoverable.
Two more problems belong in this group and appear often. A ticketing or flash-sale system is contention on inventory: reserve with an expiry, confirm on payment, release on timeout (Dabba’s offer timer, applied to seats), with a waiting room at the front door, which is rate limiting and load shedding by another name. A distributed rate limiter, asked as a problem in its own right, is the rate-limiting chapter’s counters, with the question of failing open or closed at its centre.
The atlas in one table
| Problem | What must never be wrong | Dominant pressure | Chapters that make it hard |
|---|---|---|---|
| URL shortener | a code points to one URL, forever | reads, a few viral links | reads, edge, IDs, rate limiting |
| Search autocomplete | little; staleness is fine | a request per keystroke, tight latency | derived data, sketches, edge, sharding |
| News feed | no lost posts; order roughly right | fan-out, celebrity hot keys | reads, sharding, streams, derived data |
| Notification system | no duplicate or missing critical messages | bursts, provider limits | background work, rate limiting, failure |
| Chat | same order for every member | connections, per-conversation order | realtime, streams, IDs |
| Ride matching | one ride, one driver | location writes, scarce drivers | geo, writes, background work, failure |
| Payments ledger | balanced, immutable, applied once | correctness, a few hot accounts | writes, background work, security, IDs, delivery |
| Ticketing / flash sale | no seat sold twice | a stampede on few items | writes, background work, rate limiting, failure |
Read the last column down and two things stand out. Background work and the log appear in almost every row, because nearly every hard system answers quickly and finishes the work afterwards. And the second column predicts the architecture better than the problem’s name does: the rows whose invariants are strict (ledger, ticketing, matching) are designed around conditional writes and idempotency, and the rows whose invariants are loose (feed, autocomplete) are designed around precomputation and caches.
When the atlas misleads
A map of typical solutions tempts you to skip the requirements and draw the familiar picture. Resist it. A URL shortener for a company of 2,000 employees is a single table and a web server; drawing a sharded cache cluster for it is a failure to read the numbers. A chat feature for Dabba’s riders and customers needs none of the group-chat machinery. A ledger for a startup with a thousand transactions a day is a well-designed Postgres schema, not a distributed system. The atlas tells you where to look first. The brief, the arithmetic and the invariants tell you what to build.
A good way to use it is the one this pathway used. Take one row, write a one-paragraph brief with numbers, do the arithmetic, sketch the simplest design that meets it, and find the two or three places where it breaks. Then read how a real company built it (the aggregated engineering blogs at /tech-blogs and this chapter’s reading list are good places to look) and compare their scars with your sketch. The differences are your next things to learn.
This is the end of the System Design pathway. Dabba started as a brief and a request crossing a few boxes, and finished with a reviewed design for its most delicate feature. The next pathway, AI Engineering, applies the same habits (requirements, numbers, failure paths, measurement) to systems built around models, where the component that misbehaves is often the one doing the most useful work.