System Design Interview: A Step-by-Step Framework, Prep Plan and Worked Example
You put a cache in front of the database. The read path looks tidy. Then the interviewer asks, "What happens when I create a link and click it immediately?" A replica hasn't caught up, the cache has no entry, and your otherwise impressive diagram returns a 404 for the link you just promised was ready.
Now the boxes have a job to do.
A system design interview asks you to turn an incomplete product request into a design whose behavior you can explain. The useful work happens when a request moves through the drawing, or a new constraint makes you reconsider a choice. You need components that solve the agreed problem, with their costs visible.
This guide gives you six steps, an end-to-end URL shortener, 15 practice questions, resources and a quick reference. The example's numbers are stated assumptions, rather than traffic measurements. The timing suggestions help you rehearse a conversation; they aren't a universal hiring rubric.
What is a system design interview?
In a coding interview you solve a well-defined problem. In a system design interview you receive a vague prompt like "Design Instagram" and have to turn it into a working architecture. The interviewer acts as a colleague and a product owner at the same time: they answer your questions, push back on your choices and steer you toward the parts they want to see in depth.
Four useful things to make clear in your answer:
| Area | What makes it understandable |
|---|---|
| Problem framing | You ask about users, scale and the most important features before drawing anything, and you write the answers down |
| Technical breadth | You know the standard building blocks (load balancers, caches, queues, SQL and NoSQL stores, CDNs, object storage) and when each one helps |
| Depth and trade-offs | You can go deep on one or two components and explain what you gave up: consistency vs availability, latency vs cost, simplicity vs flexibility |
| Communication | You think out loud, check in with the interviewer and keep the design coherent under follow-up questions |
Types of design rounds
The label "system design" covers several different interviews. Ask your recruiter which one you will get.
| Round | Focus | Typical prompt |
|---|---|---|
| High-level design (HLD) | Distributed architecture: services, storage, scaling, failure handling | "Design a URL shortener", "Design a news feed" |
| Low-level design (LLD) / object-oriented design | Classes, interfaces, design patterns, sometimes code for the critical part | "Design a parking lot", "Design an elevator controller" |
| Product architecture | A user-facing product end to end: APIs, data model, client–server interaction | "Design a ticket-booking site" |
| Domain-specific design | ML systems, data pipelines, mobile or frontend architecture | "Design a recommendation system" |
Candidate reports suggest junior engineers get lighter design rounds (or object-oriented design instead), while senior and staff candidates often get two. Every company sets its own loop.
The system design interview framework at a glance
These six steps give you a place to return when the conversation branches. The table is a flexible rehearsal plan for a 45-minute round with about 35–40 minutes of actual design time. Stretch the steps proportionally for a 60-minute round.
| Step | What you produce | Time |
|---|---|---|
| 1. Requirements | Functional requirements (3–5 core features), non-functional requirements (scale, latency, availability, consistency), what's out of scope | 4–6 min |
| 2. Estimates | Read and write QPS, storage, bandwidth, only to the precision that changes a decision | 2–4 min |
| 3. API and data model | The main endpoints or RPCs, the core entities and their keys | 4–6 min |
| 4. High-level design | A box-and-arrow diagram that satisfies every functional requirement, plus a walk through the main request paths | 8–10 min |
| 5. Deep dives | Two or three components examined in detail: scaling, caching, partitioning, consistency, failure modes | 10–15 min |
| 6. Wrap-up | Bottlenecks, single points of failure, monitoring, what you'd do with more time | 2–3 min |
Requirements give later choices something to answer to. If you start with Kafka and Cassandra, you can still ask what you need them for; it's easier to do that before you've drawn half a page around them.
How to approach a system design interview, step by step
Step 1 — Clarify the requirements
Write two lists where the interviewer can see them.
Functional requirements are what users can do. Pick the three to five that define the product and name what you're leaving out: "Users can post photos, follow people and see a feed. I'll skip comments and DMs."
Non-functional requirements are the qualities that shape the design:
- Scale: daily active users, read/write ratio, data growth.
- Latency: what has to feel instant (a redirect, a feed load) and what can lag (analytics, notifications).
- Availability vs consistency: can a user see slightly stale data, or must every read reflect the latest write? A bank balance and a like count have very different answers.
- Durability: can any data be lost? Usually no for user content; often yes for ephemeral data like typing indicators.
Good questions are specific: "Is it OK if a new post takes a few seconds to appear in followers' feeds?" is better than "What about consistency?"
Step 2 — Estimate the scale (briefly)
Estimates exist to make decisions: does the data fit in memory? Is caching the main lever? Do you need a CDN? Keep it to a few lines, round aggressively and state assumptions. Two shortcuts: a day has 86,400 seconds, so 1 million requests a day is about 12 per second and 1 billion a day is about 12,000 per second. Reference numbers and formulas are on our back-of-the-envelope estimation calculator. If the interviewer says to skip the math, skip it.
Step 3 — Define the API and data model
Write the three or four calls that cover your functional requirements. REST is fine unless the problem calls for something else (WebSockets for chat, streaming for video):
POST /posts {text, media_ids} -> {post_id}
GET /feed?cursor=... -> {posts[], next_cursor}Then name the core entities and the key you'll look each one up by. Single-key lookups point to a key-value or wide-column store; joins and transactions point to a relational database. Say why.
Step 4 — Draw the high-level design
Draw the simplest design that meets every functional requirement: clients, a load balancer, stateless services, stores, and any cache or queue you already know you need. Then walk one request through it per core feature. That's what reveals the missing pieces. Don't optimize yet: a correct simple design beats a complex one with a hole in it.
Step 5 — Deep dives
This is where you examine whether the first design survives its requirements. Pick the two or three hardest parts of this problem, or ask which ones the interviewer cares about. For each:
- State an uncertainty: can a replica sustain this workload at the required tail latency?
- Offer two or three options.
- Choose one and say what it costs.
Typical deep-dive topics: caching strategy and invalidation, sharding key choice and hot partitions, replication and failover, fan-out on write vs fan-out on read, idempotency and retries, rate limiting, and how the system behaves when a dependency is down.
Step 6 — Wrap up
Spend the last minutes on what could break: single points of failure, what saturates first at 10× traffic, and what you'd monitor (error rate, p99 latency, queue lag). Naming what you deliberately left out reads as judgment.
Worked example: design a URL shortener
The URL shortener (think TinyURL or bit.ly) is a classic first problem. It's small enough to finish in 45 minutes and still has real trade-offs. Here is one coherent set of choices. Other choices can work if their assumptions and failure behavior stay consistent.
1. Requirements
Functional:
- Given a long URL, return a short one (e.g.,
https://s.example/aZ3kQ9x). - Visiting the short URL redirects to the long URL.
- Optional, confirmed with the interviewer: custom aliases and expiration dates.
- Out of scope: user accounts, editing links, a full analytics dashboard (we'll keep click counting as a stretch goal).
Non-functional:
- Redirects must be fast (low tens of milliseconds at the server) and highly available. A broken short link is a broken link everywhere it's been shared.
- Each committed code identifies one stored link; allocation must resolve collisions.
- Generated codes should avoid exposing a simple sequence. Public identifiers are not access control; private links would need a separate design.
- Reads vastly outnumber writes.
2. Estimates
Assumptions (stated out loud): 10 million new links per day, a 100:1 read-to-write ratio, five years of retention, about 500 bytes per record including the long URL, metadata and index overhead, and peak traffic around 3× the average.
| Quantity | Calculation | Result |
|---|---|---|
| Write QPS | 10M / 86,400 | ~116/s average, ~350/s peak |
| Read QPS | 1B / 86,400 | ~11,600/s average, ~35,000/s peak |
| Records after 5 years | 10M × 365 × 5 | ~18 billion |
| Storage | 18.25B × 500 B | ~9 TB, ~27 TB with 3 replicas |
| Read bandwidth | 11,600/s × ~500 B | ~6 MB/s, which is small |
What these numbers tell us:
- Key length. Using base62 (
a–z,A–Z,0–9), 6 characters give 62⁶ ≈ 56.8 billion codes and 7 give 62⁷ ≈ 3.5 trillion. Six would cover 18 billion links with only about a 3× margin, and a random generator would hit collisions often as the space filled up. Seven characters gives plenty of headroom. - Storage deserves a capacity and recovery discussion. Nine TB alone does not prove one node impossible. Consider index size, throughput and recovery time when deciding whether to partition.
- The read path is the hot path. At ~35,000 peak redirects per second, a cache in front of the database is the main lever.
3. API and data model
POST /api/v1/links
body: {long_url, custom_alias?, expires_at?}
201 -> {short_code, short_url}
409 if custom_alias is taken
GET /{short_code}
302 Found, Location: <long_url>
404 if unknown or expiredGenerated codes and custom aliases share one namespace. Both are exactly seven case-sensitive base62 characters, with reserved routes rejected. A product supporting longer aliases would need different validation and a wider field. This is a logical schema, not production-ready DDL:
links
short_code CHAR(7) PRIMARY KEY
long_url TEXT NOT NULL
created_at TIMESTAMP
expires_at TIMESTAMP NULLEvery redirect is a single-key lookup with no joins or transactions, so a key-value or wide-column store (DynamoDB, Cassandra) fits naturally. A sharded relational database also works; justify either by the access pattern.
301 or 302? A permanent redirect can be cached, bypassing later counting or expiration checks. A 302 or 307 doesn't automatically make a response uncacheable either. Choose a caching policy explicitly. Here we return 302 with Cache-Control: no-store so conforming HTTP caches don't reuse a stored redirect. That preserves service-side expiration checks at the cost of requests reaching the service. See HTTP caching, RFC 9111. The service's own mapping cache is a separate layer.
4. High-level design
+------------------+
client ----------> | load balancer |
+---------+--------+
|
+--------------+---------------+
| |
+--------v--------+ +--------v--------+
| write service | | redirect service|
| (create links) | | (GET /{code}) |
+---+---------+---+ +---+---------+---+
| | | |
| +-----v------+ +-----v-----+ |
| | code RNG | | cache | |
| | (7 chars) | | (Redis / | |
| +------------+ | Memcached)| |
| +-----------+ |
| |
+---v----------------------------------------v---+
| links store (partitioned by short_code) |
+------------------------------------------------+Create path: the write service validates the URL, gets a unique code (see below), commits it with an atomic insert-if-absent, then returns the short URL. A generated collision gets a fresh candidate; a taken custom alias returns 409. All creation paths use the same uniqueness rule. DynamoDB, for example, offers conditional writes that can prevent an existing primary key from being overwritten.
Redirect path: the redirect service checks the cache. On a hit it returns a 302 with the chosen cache headers. On a miss it reads from the store, fills the cache and returns the 302 with those headers. Both services are stateless, so they scale horizontally behind the load balancer.
5. Deep dives
Deep dive A — generating short codes. Seven base62 characters provide about 3.5 trillion codes. That is capacity, not evidence that random allocations never collide. Compare the mechanisms as well as the alphabet:
| Option | How it works | Benefit | Cost or missing decision |
|---|---|---|---|
| Truncated URL hash | Hash the URL and encode seven characters | Deterministic candidate | A collision needs a new nonce/salt or another strategy; hashing the same input repeats it. Deduplication needs an ownership policy |
| Random candidate + conditional insert | Generate seven characters and insert only if absent | No shared counter | Retry with fresh randomness on conflict; use a suitable generator and don't treat a public identifier as authorization |
| Counter + base62 | Allocate integer ranges and encode IDs | Distinct generated IDs if ranges are correctly allocated | Coordination and unused ranges; custom aliases can still claim a generated code. An arbitrary reversible scramble doesn't establish unpredictability |
We'll use random candidates and atomic insertion. At 18.25B allocated out of about 3.52T, occupancy is roughly 0.52%. Conflicts are possible and handled by retrying. Custom aliases use the same primary key and return a conflict rather than replacing a mapping. This is less glamorous than "collision-free IDs," but it answers the concurrent-write question.
Deep dive B — caching the read path. Repeated reads of popular links make a mapping cache worth trying. One billion daily reads at 500 bytes gives 500 GB only under the simplifying assumption of a different entry per read. That isn't a measured working set. A 100 GB budget can be an initial experiment; calling it "20% hot data" would hide the assumption.
Measure distinct keys over the cache lifetime, hit rate, skew and entry overhead. Add replicas and failure headroom. Cached entries retain expires_at, which reads check even before cleanup. Bound TTL by expiration; when disabling a link, invalidate its entries. A popular disabled link shouldn't survive merely because it is popular.
Deep dive C — consistency and availability. Partition by hashed code when capacity measurements justify it, and replicate for recovery. Hashing spreads keys without spreading a single viral key; that needs its own cache plan.
Here, a link returned from create must work on the next read. The store needs an authoritative read path for newly committed mappings. A cache miss doesn't become a 404 because a lagging replica lacks the key: route that lookup to the writer or a strong read, accepting its latency or availability cost. Cache fill after commit helps, but isn't the guarantee because caches can evict or fail.
Another product may accept a brief new-link delay and choose eventual reads. State that user-visible compromise. It changes the requirement rather than making stale reads free.
6. Follow-ups interviewers often ask
- "How do you count clicks without slowing redirects?" Publish a click event to a queue (Kafka, Kinesis) asynchronously and aggregate in a separate pipeline. Fire-and-forget events can be lost on a crash. Reliable counting needs durable enqueue or an outbox, with its latency and complexity cost.
- "What about abuse?" Rate-limit link creation per IP or API key, and check long URLs against a malware/phishing blocklist asynchronously, disabling links that fail.
- "How do you handle expiration?" Check
expires_aton read (cheap), and run a background job, or rely on the store's TTL feature, to delete expired rows. - "Same long URL submitted twice?" If dedup is a requirement, add an index from
hash(long_url)toshort_code; otherwise give each request its own code so different users can track their own links. - "What breaks first at 10× traffic?" Cache capacity and hot keys. A single viral link can overload one cache node, so replicate hot keys or add a small in-process cache in the redirect service.
How to prepare for a system design interview
A sample 4–6 week plan
| Week | Focus | Output |
|---|---|---|
| 1 | Building blocks: load balancing, caching, CDNs, SQL vs NoSQL, replication, partitioning, queues, consistency models | One-page notes per concept, in your own words |
| 2 | The framework and estimates: practice the six steps on two easy problems (URL shortener, paste bin) | Two complete designs, timed |
| 3 | Read-heavy and feed problems: news feed, photo sharing, search autocomplete | Notes on fan-out, ranking, caching patterns |
| 4 | Write-heavy and real-time problems: chat, notifications, rate limiter, metrics ingestion | Notes on queues, WebSockets, idempotency |
| 5 | Harder problems: distributed cache, ride sharing (geo), payment system, ticket booking (contention) | Two designs per problem type |
| 6 | Mock interviews: at least three, with someone who interrupts and changes constraints | A list of your recurring gaps |
Short on time? Keep weeks 1, 2 and 6 and pick problems closest to the role.
How to practice system design interviews
- Practice out loud, with a timer. Reading solutions feels like progress, but the interview tests producing a design while talking. Record yourself once; many people find they spend 15 minutes on requirements.
- Practice in the intended tool, whether a shared whiteboard or paper.
- Do each problem twice: cold first, then read one good solution and redo it from memory a few days later.
- Practice the interruption. Have a partner change a constraint midway: "Now it's 100× the traffic." Notice which assumption changed and revise the affected paths.
- Study real systems. Company engineering blogs and papers describe how they solved these problems; Amazon's prep material recommends this.
Resources worth your time
- Designing Data-Intensive Applications by Martin Kleppmann (second edition with Chris Riccomini, O'Reilly, early 2026). Not an interview book, but it explains why storage, replication and consistency work the way they do, which is what deep dives test.
- System Design Interview – An Insider's Guide by Alex Xu (Volume 1, 2020; Volume 2 with Sahn Lam, 2022): interview problems with worked solutions. Start with Volume 1.
- The System Design Primer on GitHub: a free, community-maintained overview of concepts, with sample problems and an appendix of reference numbers.
Common system design interview questions
Most prompts are variations on a handful of patterns. Learn the core challenge of each pattern and you can handle prompts you've never seen.
| Question | Pattern | The core challenge |
|---|---|---|
| Design a URL shortener | Key-value, read-heavy | Unique ID generation, caching, redirect semantics |
| Design a paste bin | Key-value + blob storage | Separating metadata from content, expiration |
| Design a news feed (Facebook, X) | Feed / fan-out | Fan-out on write vs read, celebrity accounts, ranking |
| Design Instagram | Media + feed | Object storage and CDN, feed generation |
| Design a chat app (WhatsApp, Slack) | Real-time messaging | Persistent connections, message ordering, delivery receipts, offline users |
| Design a notification system | Async fan-out | Queues, retries, deduplication, per-channel providers |
| Design a rate limiter | Distributed counters | Token bucket vs sliding window, shared state across servers |
| Design search autocomplete | Read-heavy, precomputed | Tries or prefix indexes, offline aggregation of popular queries |
| Design YouTube / Netflix | Media streaming | Upload pipeline, transcoding, adaptive bitrate, CDN |
| Design Uber / a ride-sharing service | Geo + real-time | Geospatial indexing, location update rate, matching |
| Design Ticketmaster | High contention | Seat holds, avoiding double booking, traffic spikes at sale time |
| Design a distributed key-value store | Infrastructure | Partitioning, replication, quorum reads/writes, conflict resolution |
| Design a web crawler | Batch / pipeline | URL frontier, politeness, deduplication |
| Design a payment system | Correctness-critical | Idempotency, ledgers, reconciliation, exactly-once effects |
| Design a metrics / logging system | Write-heavy ingestion | Time-series storage, downsampling, high write throughput |
System design interview diagram tools
Remote interviews use a shared online whiteboard. Common choices:
- Excalidraw: free, open source and quick to use, with a hand-drawn look. It can be convenient for quick sketches. A former Meta interviewer writing for Hello Interview reports that it's the tool used in Meta's product architecture round.
- diagrams.net (draw.io): more precise shapes and connectors; slower to use under time pressure.
- Built-in whiteboards in interview platforms (CoderPad, CodeSignal, HackerRank and others): some companies use these instead.
Two rules matter more than the tool: ask your recruiter which one the company uses and practice in it, and keep diagrams simple: labeled boxes, directional arrows, stores drawn differently from services.
System design interview at Amazon
Amazon publishes more about its design rounds than most companies. Its interview guide says that for technical roles like Software Development Engineer, about half of the process is technical (live coding, system design discussions and problem solving) and the other half is behavioral, tied to the Leadership Principles.
Amazon's SDE III interview prep page says senior candidates should expect at least one software systems design question. It lists what the design is judged on (practicality, accuracy, efficiency, reliability, optimization and scalability) and stresses asking questions to complete and validate your design. The page links short videos from Amazon engineers. Our summary of their advice:
- Don't jump into solving. Ask about scale, performance and whether an API is needed, write the answers down, and actually use them in the design. The example uses an online bookstore.
- Make it a conversation, as if you were designing with your team. Interruptions usually mean the interviewer wants more detail, not that you're wrong.
- High-level design: the result should be an overall architecture diagram plus sequence diagrams for the important use cases. Prefer generic terms over specific products. Don't forget availability. If you claim a database feature is required, be ready to explain how it works. Before you finish, check that monitoring, analytics and billing are covered.
- Low-level design: the design should be detailed enough that a team of junior engineers could implement it, with clean APIs, entities, possibly class diagrams and code for the critical section. Be vocal about trade-offs and alternatives.
The same SDE III page says each interviewer is assigned different Leadership Principles and typically asks two or three behavioral questions, so a design round will usually include behavioral questions too. Prepare Leadership Principles stories alongside your designs. Candidates also report, unofficially, that SDE I loops have little distributed-systems design (sometimes object-oriented design instead) and SDE II and above get at least one high-level design round.
Other companies, briefly (candidate reports): Meta is widely reported to run a separate product architecture round for product engineers alongside classic system design. Google interviewers are reported to ask about systems close to their own work and to prefer that you design components rather than name a proprietary managed service. Confirm the format with your recruiter.
The 8 most common system design interview mistakes
- Designing before clarifying. Two minutes of questions saves twenty minutes of designing the wrong system.
- Naming technologies instead of explaining them. "Use Kafka" is not a design. "An ordered, durable log so consumers can replay events" is.
- Over-engineering for scale you don't have. Microservices, multi-region and sharding for 1,000 users is a red flag. Let the estimates justify the complexity.
- Spending ten minutes on arithmetic. Estimates should take two to four minutes and change at least one decision.
- No trade-offs. Every deep-dive choice should come with what it costs.
- Ignoring failure. What happens when the cache, a replica or a whole availability zone goes down?
- Monologuing. Check in every few minutes: "Does this level of detail work, or should I go deeper on storage?"
- Memorizing one answer per problem. Interviewers change constraints on purpose. Learn the patterns so you can adapt.
System design interview quick reference
1. REQUIREMENTS (4–6 min)
Functional: 3–5 core features, say what's out of scope
Non-functional: scale (DAU, read:write), latency, availability vs consistency, durability
2. ESTIMATES (2–4 min) 1M/day ≈ 12/s · 1B/day ≈ 12k/s · peak ≈ 2–3× avg (assumption)
QPS · storage = items × size × retention × replicas · bandwidth = QPS × payload
3. API + DATA MODEL (4–6 min)
3–4 endpoints · core entities + lookup keys · access pattern → store choice
4. HIGH-LEVEL DESIGN (8–10 min)
Simplest design meeting every requirement · walk each core request through it
5. DEEP DIVES (10–15 min) problem → 2–3 options → choice + cost
cache · partition key / hot keys · replication · fan-out · queues · idempotency
6. WRAP-UP (2–3 min)
SPOFs · what breaks at 10× · monitoring (errors, p99, queue lag) · what you skippedNeed the reference numbers (latency figures, powers of two, QPS and storage formulas)? Use the back-of-the-envelope estimation calculator.
FAQ
What is a system design interview?
It's an interview in which you design a large-scale software system from a vague prompt, usually in 45–60 minutes. You clarify requirements, estimate scale, propose an architecture and discuss trade-offs with the interviewer. It tests engineering judgment and communication, not memorized answers.
How do I approach a system design interview?
Requirements, quick estimates, API and data model, a simple high-level design, deep dives on the two or three hardest parts, then bottlenecks and failure modes. Think out loud throughout.
How do I prepare for a system design interview?
Learn the core building blocks first, then practice the framework on 10–15 classic problems out loud and against a timer, and finish with at least three mock interviews where someone interrupts and changes constraints. The sample four-to-six-week plan is a starting schedule; adjust it to your background and the gaps a mock reveals.
How do I crack or pass a system design interview?
Ask questions before designing, use your estimates to justify decisions, keep the first design simple, and give at least two options with clear costs for every major choice. Make the choice specific enough for the interviewer to question or change.
Is the system design interview hard?
It's hard in a different way from coding interviews: there's no correct answer to memorize, and the interviewer changes direction on purpose. It becomes much more manageable once you have a framework and have practiced about a dozen problems out loud.
Do junior engineers get system design interviews?
Sometimes. Many companies give new graduates and junior engineers no distributed design round, or a lighter one, or an object-oriented design round instead. Expectations rise steeply at senior and staff levels. Check with your recruiter.
What tool should I use to draw diagrams?
Use whatever the company uses. Ask your recruiter. Excalidraw is one free option for practice. Keep diagrams simple: labeled boxes, directional arrows, and storage drawn differently from services.
Should I read Designing Data-Intensive Applications or System Design Interview by Alex Xu?
Both, for different jobs. Xu's books teach the shape of an interview answer through worked problems. DDIA explains how databases, replication and distributed systems actually work, which deep dives require. Short on time? Start with Xu.
What's the difference between System Design Interview Volume 1 and Volume 2?
Volume 1 (2020) introduces the framework and classic problems such as a rate limiter and a URL shortener. Volume 2 (2022, with Sahn Lam) covers harder, more specialized systems. Start with Volume 1.