The HLD Refresher
The whole high-level-design round on one page — the 45-minute structure, the six numbers worth memorising, what each component is for, and a worked ten-minute example.
This compresses Foundations, Building Blocks and the Appendix into what fits in your head two days before an interview. Read the first half on day 1, the second on day 2, and skim both on day 3.
#Part 1 · The structure
- 1 0–5 · Requirements What it does, what matters, what you're skipping.
- 2 5–10 · Estimation Only numbers that change a decision.
- 3 10–15 · API + data The endpoints, the tables, and how data is split up.
- 4 15–27 · The diagram Draw it, then follow one request through it.
- 5 27–40 · Deep dives Two, properly. Depth beats breadth.
- 6 40–45 · Wrap up What breaks at 10×, what fails, what you'd watch.
Minutes 27–40 hold most of the score. Everything before them exists to buy that time.
Requirements. Three or four things it must do, then the qualities that actually shape the design: how many reads versus writes, how fast it must respond, how fresh the data must be, how much downtime is acceptable, and how big it is. Then say what you're not building. Scope discipline is scored.
Estimation. One or two numbers, each followed by "…which means". requests per second = daily users × actions each ÷ 100,000. Storage = number of things × size each × how long you keep them × number of copies. If a number doesn't change a decision, skip it and say you're skipping it.
API and data. Four or five endpoints at most. Then the tables — and always say how the data is split across machines and why. "Split by user id, because every read is for one user and it keeps their whole timeline on one machine" is one of the highest-value sentences in the round.
The diagram. Draw the boxes, then walk one write and one read through them, saying what travels along every arrow. Never leave an arrow unlabelled.
Deep dives. Pick the two hardest parts — usually the busiest path and the place where data can go stale — and go three levels down. Offer a choice: "the interesting parts here are how the feed is built and how the cache is kept fresh; which would you rather I dig into?"
Wrap up. "At ten times the traffic this breaks first, and here's what I'd do. If this component dies, here's what users see. I'd watch these three numbers." Three sentences, and they close the round strongly.
#Part 2 · The numbers
Six facts. Everything else you can derive at the whiteboard.
1 day ≈ 100,000 seconds requests/sec = users × actions ÷ 100,000
Peak ≈ 3× average (10× for launches, sales, match days)
Read from memory ~100 ns ─┐
Read from SSD ~100 µs │ memory is ~1,000× faster than disk
One network hop ~500 µs │ a hop costs more than reading 1 MB of memory
Across the world ~100 ms ─┘ physics; only moving data closer helps
One ordinary server: ~50,000 requests/sec for trivial work
~10,000/sec for real work · 64–512 GB memory
One SQL primary: ~10–50,000 writes/sec · comfortable up to ~10 TB
Redis: ~100,000 operations/sec per core, under a millisecondRough sizes: an ID is 8–16 bytes · a short text post ~300 bytes · a database row ~1 KB · a thumbnail ~10 KB · a web photo ~500 KB · an hour of 1080p video ~2 GB.
The three conclusions that do most of the work:
- If the data people actually read fits in memory across a few machines, cache it — you've just removed most of your read traffic.
- If storage passes ~10 TB or writes pass ~50,000/sec, you're splitting the data across machines, and the only question is what you split it by.
- If a step is slow, unreliable or bursty and the user doesn't need the result immediately, put it on a queue.
The full tables are in the cheat sheet.
#Part 3 · What each component is for
| Component | Use it when | The trade-off to say out loud |
|---|---|---|
| Load balancer | Always, in front of any group of servers | Simple ones just forward traffic; smarter ones can route by URL and handle HTTPS. Health checks decide what counts as "alive" |
| Cache | Lots of reads, and slightly stale data is fine | Knowing when to throw it away is the hard part. Name the pattern (e.g. cache-aside: read the cache, on a miss load from the database and store it) and always set an expiry |
| CDN | Images, video, anything static, users spread out | Cheap speed win; changes take time to reach every CDN location. Put a version in the URL (logo.v42.png) so a new file is simply a new URL, rather than trying to purge the old one everywhere |
| SQL database | Related data, transactions, queries you haven't thought of yet. The default | One machine takes all the writes. Read copies add read capacity but lag slightly behind |
| NoSQL | You know exactly how you'll read it, and there's a lot of it | You give up joins and flexible queries for easy growth. Design the table around the one query |
| Splitting data (sharding) | Past one machine's storage or write limit | Queries spanning machines get hard. Pick the split key for even spread and for the queries you'll run |
| Message queue | Decouple things, absorb bursts, retry, fan out | Adds delay before the result is visible, and messages can arrive twice — so consumers must tolerate repeats |
| Search index | Free-text search and ranking | A second copy of the data to keep in sync; nearly real-time, not real-time |
| Object storage | Files — images, video, backups | Store the link in the database, never the file itself |
| WebSockets | The server must push, within a second | Keeping connections open makes deploys and scaling harder than plain polling |
#Part 4 · The starting diagram
Most designs are this picture with two or three boxes changed. Start here and justify each deviation.
Client ─▶ CDN ─▶ LB ─▶ API gateway ──▶ Servers ──▶ Cache ──▶ Main database
(auth, │ │
rate limit) │ ├─▶ Read copies
│ └─▶ Split by key
▼
Message queue ──▶ Workers ──▶ Search index
└──▶ File storage
└──▶ Analytics- The top row is what the user waits for. Keep it fast and simple.
- Everything below the queue is what the user doesn't wait for: notifications, indexing, thumbnails, analytics.
Deciding what goes below the line is most of the design. "The write returns as soon as it's safely stored; indexing, notifications and fan-out all happen off the queue" covers a lot of ground in one breath.
#Part 5 · The five deep dives that come up everywhere
Have a paragraph ready on each.
1 · Caching. Look in the cache first, fall back to the database, and put the answer in the cache — with an expiry. Say what you cache, where, and how it gets thrown away. Name the two hard cases: a stampede (a popular item expires and a thousand requests hit the database at once — let one of them do the work while the rest wait) and a hot key (one item so popular it overloads a single cache node — copy it to several). See Caching.
2 · Splitting the data. Say the key and why. Splitting by ranges (users A–F on machine 1, G–M on machine 2…) lets you read a range in order, but popular ranges become hot spots — if you split by date, every new write lands on the "today" machine. Splitting by a hash of the key spreads data evenly, but neighbouring keys end up on different machines, so "everything between X and Y" means asking all of them. Consistent hashing makes adding machines cheap. Always mention the celebrity problem — one key (a famous account) getting so much traffic that its machine is overloaded however well the rest is spread — and one fix, such as copying that key's data to several machines.
3 · Freshness. Where do you need the absolute truth, and where is slightly-behind fine? The good answer is per operation, not per system: "the booking write must be exact — it's one conditional update on one row; the seat map can be a second out of date, and the screen says so." See CAP and PACELC.
4 · Failure. For each major box: what happens when it dies, and what does the user see? Cache down → slower, and the database takes the load. Queue backed up → things happen late, not never. Whole region down → fail over, and say how much data you'd lose. Retries need spacing (wait longer after each failure), randomness (so thousands of clients don't all retry in the same instant) and a way to detect duplicates (so a retried payment isn't charged twice). Without these, a brief failure makes every client retry at once, and that wave of retries keeps the struggling service down — the retries become the outage.
5 · Ten times the traffic. Name the first thing to break and the fix. This is the closing question, and candidates fumble it because they never worked out which box is nearest its limit.
#Part 6 · A worked ten-minute example
"Design a URL shortener" — how the pieces above go together under time pressure.
Requirements. Make a short link, redirect it, optional expiry. Far more reads than writes, redirects must be fast, and it must basically never be down — a dead shortener breaks every link ever shared. Out of scope: accounts, analytics dashboards, spam scanning.
Estimation. 100 million new links a day ÷ 100,000 = 1,000 writes/sec, about 3,000 at peak. A hundred reads per write → 100,000 reads/sec, 300,000 at peak. 500 bytes each × 100 million × 5 years ≈ 91 TB. Which means: too big for one machine, so split it; and 300,000 reads a second of tiny unchanging values is the perfect cache workload.
API.
POST /urls {long_url} → {short_url}, andGET /{code}→ redirect. Use a temporary redirect, not a permanent one: browsers cache permanent redirects forever, so you could never disable a bad link.Data.
urls(code, long_url, created_at, expires_at), split by the hash of the code. Every lookup is by code, so there are no range queries to preserve and hashing spreads load evenly.Design. CDN → load balancer → stateless servers → Redis (code → URL, roughly 99% hit rate, because a few links get most of the traffic) → the split store. Writes go to the store and populate the cache.
Deep dive: making codes. Three options. Random seven characters with a uniqueness check — 3.5 trillion possibilities, but a read before every write. A counter converted to base 62 (digits plus lower- and upper-case letters, so a short code covers a huge range) — compact, but guessable and it needs one shared counter. Or give each server a block of numbers in advance — no coordination per request, small gaps when a server restarts. I'd take the pre-allocated blocks with a random suffix.
Failure and growth. If the cache dies, all 300,000 reads a second hit the store — so keep a small local cache on each server and a circuit breaker. Records never change once written, so copies are trivially consistent. At ten times the traffic the limit is cache memory, and the fix is more cache nodes.
That's the whole round in six paragraphs. The long version is in the case study.
#Check yourself
Give the six steps of a 45-minute HLD round.Show answer
What two sentences raise an HLD score most?Show answer
How do you estimate requests per second quickly?Show answer
Recite the latency ladder.Show answer
What three conclusions do most of the estimation work?Show answer
What does the line in the starting diagram separate?Show answer
Name the five deep dives that come up everywhere.Show answer
Why use a temporary redirect in a URL shortener?Show answer
#What to carry forward
- Announce the six-step structure; spend minutes 27–40 on two deep dives.
- Every number earns a "which means"; skip numbers that change nothing.
- Memorise six facts: 100,000 s/day, 3× peak, the latency ladder, server and database limits.
- Start from the standard diagram and justify each deviation; deciding what goes below the queue is most of the design.
- Prepared candidates lose on time management: cut scope, go deep, talk while drawing.