System Design, Explained Through 10 Real Problems
System design stopped feeling abstract once I saw it as a list of "what happens when…" questions.
The idea
For a long time, “system design” sounded to me like whiteboards and big boxes with arrows. That felt abstract.
What helped was writing down real problems instead. Each one starts the same way: “What happens when…?” And each one has a known name and a known fix.
So this is my working definition: if you’re solving one of these problems on purpose, before it breaks things, you’re doing system design.
How it works: 10 problems, 10 ideas
| # | The problem | The idea behind the fix |
|---|---|---|
| 1 | The API must respond in under 50 ms | Indexes, caching, fewer network hops |
| 2 | 1M users hit the API at the same moment | Rate limiting, queues, autoscaling |
| 3 | The same payment request reaches the server twice | Idempotency |
| 4 | The app reads the same data from the DB every time | Caching |
| 5 | One server is flooded with traffic | Load balancing |
| 6 | A downstream API goes down | Timeouts, retries, fallbacks |
| 7 | The user needs 10 records out of 1M | Pagination + indexed queries |
| 8 | Sending an email and building a report inside one request | Async processing with a queue |
| 9 | 10K users today, 10M tomorrow | Horizontal scaling, stateless services |
| 10 | A huge file needs processing | Batching / chunking |
Once I had the table, I saw the 10 problems fall into four groups.
1. Make it fast (#1, #4, #7)
Most slowness I’ve seen comes from doing work you didn’t need to do.
- Cache data that’s read often and changes rarely, so the database isn’t asked the same question again and again.
- Index the columns you filter and sort on.
- Don’t fetch what you won’t show.
-- Pulls everything, then the app throws most of it away
SELECT * FROM orders WHERE user_id = 42;
-- Asks only for what the screen needs
SELECT id, amount, created_at
FROM orders
WHERE user_id = 42
ORDER BY created_at DESC
LIMIT 10;
2. Handle more people (#2, #5, #9)
One server has a limit. So you either make it bigger (vertical scaling) or add more of them (horizontal scaling).
- A load balancer spreads requests across servers.
- For that to work, the servers should be stateless: any server can handle any request, because session data lives somewhere shared (like Redis or the database).
- For sudden spikes, rate limiting and queues smooth the traffic so the system bends instead of breaking.
As a DevOps engineer, this is the part I touch most: Kubernetes Services, autoscalers and cloud load balancers are all answers to this group.
3. Fail safely (#3, #6)
Networks are unreliable. Requests get retried, and services go down.
- Idempotency means doing the same thing twice has the same effect as doing it once. For payments, the client sends a unique key with the request. The server remembers it, and if the same key shows up again, it returns the first result instead of charging again.
POST /payments
Idempotency-Key: 7f3a-... ← same key on retry = no double charge
- Fallbacks decide what the user sees when a dependency is down: cached data, a default value, or a clear “try again later”. You don’t want an endless spinner. Pair them with timeouts, so one slow service doesn’t drag everything down with it.
4. Don’t make the user wait (#8, #10)
Not everything has to happen inside the request.
- Async processing: save the order, put “send email” and “build report” on a queue, and reply to the user right away. Workers pick the jobs up in the background.
- Batching: read a big file in chunks instead of loading it all into memory at once. If something fails halfway, you can retry one chunk instead of starting over.
Where you see it
Almost everywhere, once you start looking:
- Paying online and seeing a “don’t refresh this page” warning: that’s the double-payment problem showing up in the UI.
- An “Export started, we’ll email you the file” message: async processing.
- Infinite scroll on a feed: pagination.
- A site that’s slow but still loads during a sale: load balancing and scaling doing their job.
What I learned
- System design is a list of “what happens when…?” questions. I find it much easier to learn one problem at a time than “system design” all at once.
- Every fix has a cost. A cache can serve stale data. Async means the user doesn’t get the result immediately. A fallback shows less than the real thing. Choosing which cost you can live with is the actual design work.
- Most of these ideas are old and well-named. Knowing the name (idempotency, backpressure, circuit breaker) is half the battle, because then you can find how others solved it.
I’m still exploring each of these in depth. Next, I want to write a proper post on each group.