- A system design interview is an open-ended, 45-minute collaborative design session. There is no single right answer; you are judged on how you think, not on reproducing a famous architecture.
- Use a repeatable 6-step framework: ① clarify requirements → ② estimate scale → ③ define the API → ④ data model + high-level design → ⑤ deep dives → ⑥ bottlenecks, trade-offs & wrap-up.
- Spend time where the signal is: roughly 10 minutes on scoping (steps 1–3), 10–12 on the high-level design, 15 on deep dives, 5 on wrap-up.
- Interviewers score problem navigation, solution design, technical depth, trade-off reasoning and communication. Thinking aloud, stating assumptions and driving the conversation matter as much as the boxes you draw.
- Every box in this guide's Instagram diagram can be "derived" by walking through the framework — this lesson shows which step produces which box and which lesson teaches it.
1. The problem: why do you need a framework?
Imagine the interviewer says just one sentence: "Design Instagram." That is it. No spec, no numbers, no list of features. Instagram is a product with photo and video posts, Reels, Stories, a ranked feed, Explore, search, direct messages, notifications, shopping, live video and ads — built by thousands of engineers over more than a decade. You have 45 minutes.
Candidates without a method tend to fail in a few predictable ways:
- They start drawing immediately. Ten minutes later they have a detailed design for a feature the interviewer did not care about, and no time left for the part that mattered (usually the feed).
- They freeze. The problem is so big that they do not know where to begin, and silence fills the room.
- They recite buzzwords. "We'll use Kafka, Cassandra, Redis and Kubernetes" — without explaining why each is needed or what it costs.
- They never go deep. They draw twenty boxes and can't explain how any one of them actually works under load.
A framework fixes all four. It gives you an opening move (ask questions), a sequence that builds each decision on the previous one (requirements drive numbers, numbers drive architecture), and checkpoints where you can glance at the clock and adjust. It also signals seniority: experienced engineers do work this way in real design reviews.
2. The 6-step framework at a glance
Here is the whole method on one page. Each step produces an artifact that you leave visible on the whiteboard so that you and the interviewer can refer back to it.
| Step | Question it answers | Artifact you leave on the board | Lesson(s) in this guide |
|---|---|---|---|
| 1. Clarify requirements | What exactly are we building, for whom, and how good must it be? | A short list of in-scope features + non-functional targets | Requirements |
| 2. Estimate scale | How big is it? Reads vs writes? Bytes per day? | QPS, storage, bandwidth, cache size — 5–8 numbers | Back-of-the-Envelope Estimation |
| 3. Define the API | How do clients talk to the system? | 5–8 endpoint signatures | API Design |
| 4. Data model + high-level design | What are the entities, where are they stored, which components exist? | Tables/keys + a box-and-arrow diagram | Databases, Microservices |
| 5. Deep dives | How do the hardest parts actually work at scale? | Zoomed-in diagrams, algorithms, sequence flows | News Feed, Media Upload, … |
| 6. Bottlenecks & wrap-up | What breaks first? What did we trade away? What next? | A list of risks, mitigations and future work | Core Principles, CAP |
The order matters because each step feeds the next. Requirements tell you what to estimate ("do we need to store video?"). Estimates tell you which architecture is necessary ("100K reads/s means we need caching and replicas; 1 PB/day of media means object storage plus a CDN"). The API tells you which services and data you need. The high-level design tells you where the risky parts are — and those become your deep dives.
3. Step 1 — Clarify requirements (≈ 5 minutes)
The prompt is deliberately vague. The interviewer wants to see whether you can turn ambiguity into a crisp problem statement — exactly what a senior engineer does when a product manager says "we want Stories". You need two lists:
- Functional requirements — what the system does (users can upload a photo; users see a feed of people they follow).
- Non-functional requirements — how well it does it: scale, latency, availability, consistency, durability, security, cost.
3.1 Narrow the scope out loud
You cannot design all of Instagram in 45 minutes, so propose a scope and let the interviewer correct you. A good opening sounds like this:
You: "Instagram is huge, so let me propose a scope and you tell me if you'd
like to change it. Core: users upload photos and videos with a caption;
users follow other users; users see a home feed of posts from people they
follow; users can like and comment. I'll treat Stories, DMs, search and
Explore as extended features — I'll show where they plug in but won't
design them in depth unless you want me to. Ads, shopping and live video
are out of scope. Does that sound right?"
Interviewer: "Sounds good. Focus on the feed and uploads."
You: "Great. A few questions about scale and quality..."
Notice what happened: you proposed instead of asking an open question ("what features do you want?"), which shows product sense and keeps control of the clock. The interviewer then told you where the signal is: feed and uploads. That one sentence decides your deep dives.
3.2 The questions worth asking
| Category | Question | Why it changes the design |
|---|---|---|
| Users & scale | How many daily active users? Global or one country? | 1M DAU fits on a single database; 500M DAU needs sharding, caching and multiple regions. |
| Content | Photos only, or video too? Max file size? | Video adds transcoding, adaptive streaming and ~10× more storage and bandwidth. |
| Feed | Chronological or ranked? How fresh must it be? | Ranking needs an ML pipeline; freshness decides push vs pull fan-out. |
| Graph | Is following one-way? Are there celebrities with 100M+ followers? | Celebrities break naive fan-out-on-write (the "hot key" problem). |
| Latency | What feed load time is acceptable? | A p99 of 200 ms forces pre-computed timelines in memory. |
| Consistency | Is it OK if a like count is briefly stale? | "Yes" lets you use eventually consistent counters — see CAP & consistency. |
| Privacy | Private accounts? Blocking? Data deletion laws? | Every read path needs an authorization check; deletion must propagate to caches, CDN and backups. |
The detailed list of clarifying questions — with example answers — lives in the Requirements lesson.
3.3 Write the requirements down
Keep a corner of the board for this and never erase it. It becomes your contract: in step 6 you will walk back through it and show that every requirement is satisfied.
FUNCTIONAL (core) NON-FUNCTIONAL
- upload photo/video + caption - 500M DAU, global
- follow / unfollow - feed p99 < 300 ms (server), media via CDN
- home feed (ranked) - 99.99% availability for feed & upload
- like / comment - never lose an acknowledged upload
EXTENDED: stories, DMs, search - feed/likes: eventual consistency OK
OUT: ads, shopping, live - read-heavy (~100:1 views : uploads)
4. Step 2 — Estimate the scale (≈ 3–5 minutes)
Back-of-the-envelope estimation converts the requirements into a handful of numbers that justify architectural decisions. The goal is the right order of magnitude, not precision. Round aggressively: 1 day ≈ 86,400 s ≈ 105 s.
Assume 500M DAU.
Uploads: 100M posts/day → 100M / 10^5 s ≈ 1,000 writes/s (peak ~3,000/s)
Feed: each user loads ~20 feed pages/day → 10B/day → ~100K reads/s (peak ~300K/s)
Storage: 100M posts × ~1.5 MB (photo + renditions) ≈ 150 TB/day photos alone
video makes it several hundred TB/day → object storage, not a database
Egress: 500M users × ~100 images × 200 KB ≈ 10 PB/day of images → CDN is mandatory
What each number tells you:
- ~100K–300K feed reads/s vs ~1K uploads/s → the system is read-heavy; optimise reads: pre-computed timelines, caches, read replicas.
- Hundreds of TB/day of media → blobs go to object storage, only metadata goes to databases.
- PB/day egress → a CDN must serve media; the origin could never handle it.
5. Step 3 — Define the API (≈ 3–5 minutes)
The API is the contract between clients and your system. Writing it down forces you to be concrete about what data flows where, and it reveals the services you will need. Keep it to the core use cases; you do not need every field.
# Upload: two-phase, so media bytes never pass through our app servers
POST /v1/media/upload-url → { media_id, upload_url (pre-signed, expires in 15 min) }
PUT {upload_url} (client uploads bytes directly to object storage)
POST /v1/posts { media_ids[], caption, location? } → { post_id, status: "processing" }
# Feed: cursor-based pagination
GET /v1/feed?cursor=<opaque>&limit=20 → { posts: [ {post_id, author, media_urls[], caption,
like_count, liked_by_me, ...} ], next_cursor }
# Social graph
POST /v1/users/{user_id}/follow
DELETE /v1/users/{user_id}/follow
# Engagement
POST /v1/posts/{post_id}/likes (idempotent: liking twice = one like)
POST /v1/posts/{post_id}/comments { text }
GET /v1/posts/{post_id}/comments?cursor=
# Profile
GET /v1/users/{user_id}/posts?cursor=
Points worth saying out loud while you write:
- Authentication comes from a token in the header, validated at the API Gateway — the user id is never trusted from the request body. See Authentication.
- Cursor pagination, not
offset: new posts arrive constantly, so offsets would skip or duplicate items, and deep offsets are slow. - Idempotency: mobile networks retry. A like or a post creation must be safe to repeat (idempotency keys, or "like" as a set-membership operation).
- Pre-signed upload URLs keep gigabytes of video off the app servers — detailed in Media Upload.
- Protocol choice: REST/JSON for public endpoints, gRPC between internal services, WebSockets for DMs — see API Design.
6. Step 4 — Data model + high-level design (≈ 10–12 minutes)
6.1 Data model first
List the core entities, their key fields and — most importantly — the access patterns (how they are read). The access pattern decides the database and the partition key, not the other way round.
| Entity | Key fields | Main access pattern | Store (why) |
|---|---|---|---|
| User | user_id, username (unique), name, bio, is_private | Lookup by id / by username; uniqueness on signup | PostgreSQL, sharded + replicas (strong uniqueness, relational) |
| Post | post_id, user_id, caption, media keys, created_at | "Latest posts of user X", "post by id" | Cassandra partitioned by user_id, clustered by post_id desc |
| Media | bytes of each rendition | Fetch by URL | Object storage (S3) + CDN |
| Follow | follower_id, followee_id, created_at | "Who does X follow?", "Who follows X?" | Graph store; edges stored in both directions |
| Like / Comment | post_id, user_id, (text), created_at | Count per post; "did I like it?"; latest comments | Cassandra + counters in Redis |
| Timeline | user_id → list of post_ids | Read the top N quickly | Redis (pre-computed feed cache) |
Mention ID generation here: post ids should be globally unique and roughly time-sortable so "latest first" is a simple sort — Instagram's publicly described 64-bit ids (timestamp + shard id + sequence) are the classic example; see Unique ID Generation.
6.2 Draw the high-level design
Now draw boxes and arrows that satisfy every functional requirement end-to-end, at a single level of detail. Start simple and grow it, narrating as you go:
- Client → load balancer → API gateway → services. One sentence each: the load balancer spreads traffic; the gateway does TLS, auth and rate limiting.
- Split services by responsibility: Upload, Feed, Follow/Graph, Like & Comment, User. Make them stateless so they scale horizontally.
- Attach a data store to each, using the table above.
- Walk through the write path: upload bytes to object storage → create post → publish "post created" event to Kafka → workers resize/transcode, fan the post out to followers' timelines, index for search, send notifications.
- Walk through the read path: feed service reads the timeline from Redis → hydrates post metadata (cache, then Cassandra) → returns JSON with CDN URLs → client fetches media from the CDN.
7. Step 5 — Deep dives (≈ 15 minutes)
This is where most of the technical-depth signal comes from. Pick 2–3 components that are (a) hardest, (b) most specific to this problem, and (c) of interest to the interviewer. For Instagram the usual candidates are:
📰 Feed generation
Fan-out on write vs read, the celebrity problem, hybrid push/pull, ranking, cache sizing. → News Feed
📤 Media upload & processing
Pre-signed URLs, resumable uploads, transcoding pipeline, renditions, moderation. → Upload, Processing
🗄️ Sharding the data
Partition keys, hot shards, resharding, cross-shard queries. → Sharding
❤️ Likes & counters
Hot posts with millions of likes per hour, sharded counters, approximate counts. → Likes & Comments
💬 Real-time DMs
WebSockets, presence, ordering, delivery receipts. → Direct Messaging
⚡ Caching
What to cache, eviction, invalidation, thundering herd. → Caching
7.1 How to run a deep dive
- Ask or propose: "I think the feed is the most interesting part — shall I go deep there, or would you prefer the upload pipeline?"
- State the sub-problem precisely: "We need each user's feed in <300 ms p99, at ~300K feed reads/s, where some authors have 500M followers."
- Present 2+ options with a comparison (fan-out on write vs on read).
- Choose one, with numbers ("push for 99.9% of authors; pull for the ~0.1% with more than ~1M followers — otherwise one celebrity post triggers hundreds of millions of writes").
- Walk through failure cases: what if a fan-out worker crashes mid-way? (Kafka offsets → retry; idempotent writes to timelines.)
- Close the loop by updating the main diagram.
8. Step 6 — Bottlenecks, trade-offs & wrap-up (≈ 5 minutes)
Finish strong. Walk the diagram looking for things that will break, then summarise.
- Single points of failure: is anything not replicated? Load balancers in pairs, databases with replicas and automated failover, services across availability zones. See Core Principles.
- Hot spots: a viral post's like counter, a celebrity's shard, a popular hashtag in search. Mitigate with sharded counters, caching and request coalescing.
- Failure handling: timeouts, retries with backoff, circuit breakers, graceful degradation ("if ranking is down, serve a chronological feed") — see Resilience Patterns.
- Consistency trade-offs you made: "feeds and like counts are eventually consistent; usernames are strongly consistent" — see CAP & Consistency.
- Operations: metrics, logs, traces, alerts on SLOs — Observability; disaster recovery and regions — Multi-Region.
- Future work: "With more time I'd design Explore ranking and multi-region active-active writes."
A crisp 60-second summary sounds like: "To recap: uploads go directly to S3 via pre-signed URLs; metadata in Cassandra sharded by user; an event on Kafka triggers media processing and a hybrid fan-out into Redis timelines; reads hit Redis and the CDN, so the read path never touches the primary databases in the common case. The main risks are celebrity fan-out and hot counters, which we handle with pull-on-read and sharded counters. We chose eventual consistency for feeds and counts to get 99.99% availability and low latency."
9. The 45-minute time budget
Most loops give you 45 minutes of design time (sometimes 60 with introductions). A typical plan, and what to do when you fall behind:
| Minutes | Phase | Goal | If you are running late… |
|---|---|---|---|
| 0–2 | Introductions / restate the problem | Confirm what is being asked | Skip small talk; restate in one sentence |
| 2–7 | 1. Requirements | Scope + 5–6 non-functional targets | Propose a scope and ask "OK?" rather than asking open questions |
| 7–11 | 2. Estimation | QPS, storage, bandwidth, read:write ratio | Give 3 numbers verbally; skip the rest |
| 11–15 | 3. API | Core endpoints | Write only the feed + upload endpoints |
| 15–27 | 4. Data model + high-level design | Complete end-to-end diagram | Draw it, describe read and write paths in two sentences each |
| 27–40 | 5. Deep dives | 2–3 components in depth | Do one deep dive well instead of three badly |
| 40–45 | 6. Bottlenecks & wrap-up | Risks, trade-offs, summary; questions | Never skip the 60-second summary |
10. What interviewers evaluate
Companies use slightly different words, but nearly all rubrics boil down to five or six dimensions. Knowing them tells you what to make visible.
| Dimension | What a strong signal looks like | What a weak signal looks like |
|---|---|---|
| Problem navigation / scoping | Asks targeted questions, proposes a scope, prioritises core features, identifies the hard parts early | Starts drawing immediately; tries to design everything; never confirms assumptions |
| Solution design (breadth) | A complete, coherent, working end-to-end design; components have clear responsibilities | Disconnected boxes; requirements left unaddressed; data flow unclear |
| Technical depth | Explains how components work (partition keys, cache eviction, fan-out mechanics), with numbers | Buzzwords ("use Kafka") without mechanics; hand-waving at the first follow-up |
| Trade-off reasoning | Compares alternatives, picks one with justification, names what was sacrificed | Presents one option as obviously correct; cannot say what it costs |
| Scalability & operations | Finds bottlenecks and SPOFs; thinks about failures, monitoring, deployment | Assumes nothing fails; no awareness of hot spots |
| Communication & collaboration | Thinks aloud, structured, checks in, adapts to hints, handles pushback calmly | Long silences; monologue; ignores hints; defensive |
10.1 How expectations change by level
| Level | Typical expectation |
|---|---|
| Junior / new grad | Often no system design round, or a simpler one. Reasonable high-level design with some guidance. |
| Mid-level | Complete high-level design on their own; one solid deep dive; knows standard building blocks. |
| Senior | Drives the whole session; multiple deep dives; proactively raises trade-offs, failure modes and operational concerns. |
| Staff+ | All of the above, plus questioning the requirements themselves, cost and organisational implications, evolution over years, and nuanced alternatives. |
11. Communication tips
A design interview is a conversation with a colleague, not an exam you sit silently. The interviewer can only grade what they can hear and see.
11.1 Think aloud
Narrate your reasoning, including the options you reject: "I could store the feed in the database and query it on read, but at 300K reads/s with a join across hundreds of followees that would be far too slow, so I'll pre-compute timelines." The rejected option and the reason are often worth more than the choice itself.
11.2 Drive the conversation
- Announce the plan at the start: "I'll clarify requirements, do quick estimates, sketch the API, then the high-level design, and then go deep on the feed."
- Signpost transitions: "That covers the write path; now the read path."
- Offer choices instead of waiting: "I can go deep on fan-out or on media processing — which is more interesting to you?"
11.3 State assumptions explicitly
When you lack information, assume, say so, and move on: "I'll assume a ranked feed with eventual consistency; if it must be strictly chronological the design changes in this way…". Unstated assumptions look like gaps; stated ones look like judgement.
11.4 Check in, but don't ask permission for everything
Every few minutes: "Does this make sense so far? Anything you'd like me to focus on?" — but do not ask "should I use a cache?". Decide, justify, and let them push back.
11.5 Treat hints and pushback as gifts
If the interviewer asks "what happens when Cristiano Ronaldo posts?", that is a hint that your fan-out design has a hole. Do not defend the old design — say "good point, that breaks push fan-out; let me fix it" and adapt. Changing your mind in response to new information is a positive signal.
11.6 Keep the board organised
Requirements and numbers in one corner, API in another, the main diagram in the centre. Label arrows (sync vs async, what data flows). A tidy board makes your thinking easy to follow — and easy to grade.
12. How to discuss trade-offs
"Everything is a trade-off" is a cliché; the skill is making the trade-off specific. Use this template:
Applied to Instagram's feed:
"Options: fan-out on write (push), fan-out on read (pull), or hybrid. Criteria: our requirement is p99 < 300 ms at ~300K reads/s, and reads outnumber posts ~100:1. Decision: push, because each post is written once to ~200 average followers' timelines and then read many times cheaply. Cost: write amplification — ~100M posts/day × ~200 followers = ~20B timeline inserts/day — and wasted work for inactive followers; and celebrities with 100M+ followers would cause massive bursts. Mitigation: pull for accounts above a follower threshold and merge at read time; skip fan-out to users inactive for 30+ days. Revisit if the read:write ratio drops (e.g. a write-heavy product)."
The most common trade-off axes in system design:
| Axis | Instagram example | Lesson |
|---|---|---|
| Consistency vs availability / latency | Eventually consistent like counts vs strongly consistent usernames | CAP & Consistency |
| Read cost vs write cost | Push fan-out (cheap reads, costly writes) vs pull | News Feed |
| Latency vs cost | Keeping timelines in RAM vs on disk | Caching |
| Simplicity vs scalability | One PostgreSQL vs sharded clusters | Sharding |
| Sync vs async | Transcode during upload request vs via a queue | Message Queues |
| Freshness vs efficiency | Short vs long cache TTLs; CDN invalidation | CDN |
| Build vs buy | Own CDN vs commercial CDN | CDN |
13. A printable checklist / template
Print this (or memorise it) and run through it in every practice session until it becomes automatic.
SYSTEM DESIGN CHECKLIST [ time ]
──────────────────────────────────────────────────────────────────────────
□ 0. Restate the problem in one sentence. Announce the plan. 0–2 min
□ 1. REQUIREMENTS ~5 min
□ Users / actors? Core use cases (3–5)? What's out of scope?
□ Scale: DAU, geography, growth. Read:write ratio.
□ Latency targets (p99) per key operation.
□ Availability target. Durability needs.
□ Consistency per feature (strong where? eventual where?).
□ Security / privacy / compliance. Cost constraints?
□ Write the list on the board. Confirm with interviewer.
□ 2. ESTIMATES (only what you'll use) ~4 min
□ Read QPS and write QPS (avg and peak = 2–3× avg)
□ Storage per day / per year (media vs metadata)
□ Bandwidth in / out. Cache size (hot set).
□ Say what each number implies for the design.
□ 3. API ~4 min
□ Core endpoints, inputs, outputs. Auth. Pagination (cursor).
□ Idempotency for writes. Sync vs async (202 Accepted).
□ 4. DATA MODEL + HIGH-LEVEL DESIGN ~12 min
□ Entities, keys, access patterns → choice of store, partition key.
□ Clients → DNS/CDN → LB → gateway → stateless services → stores.
□ Async path: events → queue → workers.
□ Walk the WRITE path and the READ path end-to-end.
□ Every functional requirement covered?
□ 5. DEEP DIVES (2–3, agreed with interviewer) ~15 min
□ State sub-problem + numbers. ≥2 options compared.
□ Decide + justify. Failure cases. Update the diagram.
□ 6. WRAP-UP ~5 min
□ SPOFs, hot spots, bottlenecks → mitigations.
□ Failure handling: timeouts, retries, degradation, DR.
□ Monitoring / SLOs. Security. Cost.
□ Trade-offs made. Future work. 60-second summary.
14. How to practise
- Learn the building blocks first. You cannot reason about trade-offs between components you don't understand. Work through Parts 1–5 of this guide (load balancers, caches, databases, sharding, queues, CDNs…).
- Study one system deeply. This guide uses Instagram because it exercises almost every building block: media storage, feeds, graphs, counters, search, real-time messaging, notifications and ML. Once you can design Instagram end-to-end, systems like Twitter/X, TikTok, Facebook or Pinterest are variations.
- Practise out loud, on a timer. Set a 45-minute timer and talk to an empty room, a rubber duck or a recording app. Reading designs silently trains recognition; speaking trains production — and the interview tests production.
- Do mock interviews with a partner. Swap roles; being the interviewer teaches you what good answers look like. Ask for feedback against the rubric in section 10.
- Review and redo. After each session, write down the two weakest moments (a question you couldn't answer, a step that ran over) and study exactly those. Redo the same problem a week later.
- Vary the problem. Practise related prompts that reuse the same blocks: design Twitter's timeline, a chat app, a URL shortener, a notification system, YouTube, a rate limiter, a web crawler, a ride-sharing dispatcher.
- Drill estimation separately. Five-minute daily drills ("how much storage do 1B tweets need?") build fluency with powers of ten — see Estimation.
- Read real engineering write-ups (company engineering blogs, famous papers like Dynamo, Bigtable, TAO, Memcache at Facebook, The Tail at Scale) once you have the basics — they give you true, specific examples to cite.
15. How to use this guide: a learning path
The guide is organised as one architecture — Instagram — explained box by box. You can click any box on the interactive diagram to jump to its lesson, but if you are starting from zero, follow this order:
| Stage | Lessons (in order) | You will be able to… |
|---|---|---|
| 1. Foundations | How to Approach → Requirements → Estimation → Core Principles → CAP & Consistency | Scope a problem, size it, and speak the vocabulary of trade-offs |
| 2. Edge & networking | Networking → Clients → DNS → CDN → Load Balancing → API Gateway → Rate Limiting → Auth | Explain how a request gets from a phone to a server, safely and fast |
| 3. Data layer | Databases → Indexing → Replication → Sharding → Consistent Hashing → Caching → Object Storage → ID Generation | Choose and scale storage for any access pattern |
| 4. Async processing | Message Queues & Kafka → Media Processing → Notifications → Analytics & ML | Decouple work with events and background workers |
| 5. Services | API Design → Microservices → Upload → Social Graph → News Feed → Likes → Stories → Search → DMs | Design each Instagram feature in depth |
| 6. Operations | Resilience → Observability → Multi-Region → Security | Keep it running, measurable and safe |
| 7. Put it together | Request Flows → Full Interview Walkthrough; keep the Glossary handy | Deliver the whole design in 45 minutes |
16. How Instagram uses the framework: mapping the steps onto the diagram
The architecture on this guide's home page is not a random collection of popular technologies — every box is the output of one of the six steps. The numbered badges below show which step "creates" each part of the design.
| Step | What it produces in the Instagram diagram | Lessons that teach it |
|---|---|---|
| ① Requirements | Which service boxes exist at all. "Stories in scope" adds the Stories Service + TTL storage; "DMs in scope" adds the WebSocket messaging service and Messages Store; "search" adds Elasticsearch and the Search Indexer. | Requirements |
| ② Estimation | Why there is a CDN (PB/day egress), why object storage (hundreds of TB/day), how many Redis nodes, Kafka partitions, DB shards and app servers. | Estimation |
| ③ API | The routes on the API Gateway; REST vs WebSocket; pre-signed upload URLs. | API Design, API Gateway, Auth, Rate Limiting |
| ④ Data model + HLD | The services row, the data-store row and the choice of store per entity; the Kafka event bus. | Microservices, Databases, Object Storage, Message Queues, IDs |
| ⑤ Deep dives | Fan-out workers + Redis timelines, media workers + renditions, sharded counters, WebSocket gateways. | News Feed, Upload, Processing, Likes, Graph, DMs, Search, Stories |
| ⑥ Bottlenecks & trade-offs | Replicas behind every store, redundant load balancers, caches in front of databases, multi-region copies, monitoring. | Core Principles, CAP, Replication, Sharding, Caching, Resilience, Multi-Region, Observability |
When you get "Design Instagram" in an interview, a strong performance in this guide's terms is:
- Scope to upload + follow + feed + like/comment, flag Stories/DMs/search as extended (Requirements).
- Size it: ~1K uploads/s, ~100–300K feed reads/s, hundreds of TB/day media, PB/day egress (Estimation).
- Write 6–8 endpoints with cursor pagination and pre-signed uploads (API Design).
- Draw the diagram top to bottom: clients, edge, services, Kafka, workers, stores, CDN (Request Flows).
- Go deep on the feed (hybrid fan-out, Redis sizing, ranking) and media pipeline (News Feed, Media Processing).
- Close with SPOFs, hot keys, consistency choices and a recap (Core Principles, CAP).
The complete minute-by-minute script is in the Full Interview Walkthrough.
17. Trade-offs & common pitfalls
Even the framework itself is a trade-off: structure versus flexibility.
✅ Following a framework
- Never stuck for the next move; no blank-page panic
- Guarantees coverage of requirements, scale and failure handling
- Easy for the interviewer to follow and grade
- Built-in checkpoints for time management
- Mirrors how real design reviews work
⚠️ Risks if applied rigidly
- Robotic delivery — "step 3 now" without connecting to the problem
- Over-spending time on estimation or API details the interviewer doesn't need
- Ignoring the interviewer's steering because "the template says so"
- Generic designs that never engage with what makes this problem hard
The most common mistakes (and the fix)
- Jumping into the solution. Fix: always spend the first 5 minutes on requirements, even if you "know" the problem.
- Asking questions without proposing answers. "What scale?" → better: "I'll assume ~500M DAU globally — sound right?"
- Estimating numbers you never use. Every number must justify a decision (CDN, sharding, cache size), or skip it.
- Going deep too early. Designing the transcoding ladder at minute 12 means no feed at minute 40. Breadth first.
- Buzzword architecture. Naming technologies without explaining mechanics or need. Say what problem each box solves.
- One option only. Always mention at least one alternative and why you rejected it.
- Ignoring the hot path. For Instagram, the feed read path at ~300K req/s is where performance matters; spending equal time on the "change password" flow wastes signal.
- Forgetting failures. No discussion of what happens when a node, a zone or a dependency dies.
- Silent thinking. Long pauses with no narration — the interviewer can't grade thoughts they can't hear.
- Over-engineering. Multi-region active-active with consensus everywhere for a design that only needs a single region. Match complexity to requirements.
- Being defensive. Treat pushback as collaboration; adapt.
- No summary. Running out of time without a recap leaves the interviewer to assemble your design themselves.
18. Real-world technologies
In the interview you'll name concrete technologies. Use this "default toolbox" — and always say why:
| Need | Typical choices | Reach for it when… |
|---|---|---|
| Traffic distribution | DNS (Route 53), L4/L7 load balancers (NGINX, HAProxy, Envoy, cloud LBs) | Always — more than one server |
| Edge for static media | CDN (CloudFront, Akamai, Cloudflare, Fastly) | Large, cacheable, globally-read content |
| Relational / strongly consistent data | PostgreSQL, MySQL (+ Vitess/Citus for sharding), Spanner/CockroachDB | Uniqueness, transactions, relations (users, accounts) |
| High-write, wide-column data | Cassandra, ScyllaDB, HBase, DynamoDB | Huge write volume, simple key-based access (posts, likes, messages) |
| Cache / in-memory structures | Redis, Memcached | Hot reads, timelines, counters, sessions |
| Blob storage | Amazon S3, GCS, Azure Blob, Ceph | Photos, videos, backups — anything large and immutable |
| Event streaming / queues | Kafka, Pulsar, Kinesis, RabbitMQ, SQS | Async work, fan-out, decoupling producers and consumers |
| Search | Elasticsearch, OpenSearch, Solr | Full-text and typeahead search |
| Coordination | ZooKeeper, etcd | Leader election, config, service discovery |
| Batch / ML | Spark, Flink, data warehouses, feature stores | Analytics, ranking model training |
| Whiteboarding (practice) | Physical whiteboard, Excalidraw, draw.io, any shared doc | Mock interviews — practise in the medium you'll be interviewed in |
19. Interview corner
The interviewer says "Design Instagram." What are your first two minutes?
Restate the problem and announce a plan: "I'll start with requirements, do a quick estimate, define the core API, sketch a high-level design, then go deep on the feed and upload pipeline, and finish with bottlenecks." Then propose a scope: core = upload photo/video, follow, home feed, like/comment; extended = Stories, DMs, search, Explore; out = ads, shopping, live. Ask them to confirm, then ask the 3–4 non-functional questions that change the design most: scale (DAU, global?), ranked vs chronological feed, latency target, and whether eventual consistency is acceptable for feeds and counts.
How do you decide what to deep-dive on?
Three filters: (1) what's hardest at this scale — for Instagram, feed generation for 500M DAU with celebrity accounts, and the media pipeline at hundreds of TB/day; (2) what's specific to this problem rather than generic plumbing (a load balancer is rarely the best deep dive); (3) what the interviewer signals interest in. I propose the two I think matter most and let the interviewer choose — that both shows judgement and makes sure I spend time where they're grading.
You realise halfway through that your design has a flaw. What do you do?
Say so explicitly and fix it: "Actually, push fan-out breaks for an account with 300M followers — one post would mean 300M Redis writes. Let me change this to a hybrid: push for normal accounts, pull at read time for accounts above ~1M followers." Self-correction is a strong senior signal; hiding the flaw is a weak one, because the interviewer almost certainly noticed already.
How much time should estimation take, and what if the interviewer wants to skip it?
Three to five minutes, only for numbers that drive decisions: peak read/write QPS, storage per day/year, egress bandwidth and maybe cache size. If the interviewer wants to skip it, skip it — but still mention the conclusions verbally when they matter ("this is read-heavy by about 100:1, so I'll optimise the read path"). Numbers are a tool for justifying design, not a ritual.
What separates a senior answer from a mid-level answer for the same design?
A mid-level candidate produces a correct design when prompted. A senior candidate drives: sets the agenda, makes and justifies decisions with numbers, raises failure modes before being asked (hot shards, celebrity posts, cache stampedes, region outages), discusses consistency per feature, mentions observability and operability, and summarises trade-offs. Staff-level adds questioning requirements, cost, evolution over time and organisational impact (which team owns which service).
How do you handle an interviewer who keeps interrupting with detailed questions while you're still doing the high-level design?
Answer briefly (one or two sentences) so they get the signal they want, then park the detail: "I'll come back to this in the deep dive — let me first finish the end-to-end flow so we have something complete." Write a note on the board ("TODO: counter hot-spot") so they see you won't forget. If they insist, follow them — they may want to assess depth on that topic specifically.
How do you talk about trade-offs without sounding vague?
Use the pattern: options → criteria (from the requirements) → decision with numbers → cost → mitigation/when to revisit. E.g. "Cassandra vs PostgreSQL for likes: we need ~60K writes/s average, simple key access and no cross-row transactions, so Cassandra; we give up strong consistency and ad-hoc queries, which is fine because like counts may be slightly stale; analytics queries go to the warehouse instead."
What should your final summary contain?
In about a minute: the core read and write paths in one sentence each; the two or three key decisions and why (pre-signed uploads to S3 + CDN; hybrid fan-out into Redis; Cassandra sharded by user_id); the main risks and their mitigations; the consistency/availability choices; and what you'd do next with more time. It should map back to the requirements you wrote at the start.
20. Check your understanding
Put these in the right order: deep dives, API, estimation, wrap-up, requirements, high-level design.
Requirements → estimation → API → (data model +) high-level design → deep dives → wrap-up. Each step depends on the previous one: requirements decide what to estimate; estimates justify architecture; the API reveals the services and data; the high-level design reveals where the hard parts are.
You are at minute 30 and haven't started any deep dive yet. What do you do?
Say it out loud and re-plan: "We're at 30 minutes, so I'll do one deep dive — the feed — and keep 5 minutes for bottlenecks and a summary." One good deep dive beats two rushed ones, and the wrap-up must not be dropped.
Numeric: 100M posts per day. Roughly what is the average and peak write QPS for post creation?
100M / ~105 s ≈ 1,000 posts/s average (precisely ≈ 1,157/s). Peak is typically 2–3× average → ~2,000–3,500/s. That's modest — the conclusion is that post creation is not the bottleneck; fan-out (each post × hundreds of followers) and feed reads are.
Which is the better clarifying question: "What features should I build?" or "I'll focus on upload, follow, feed and likes, and treat Stories and DMs as extensions — OK?" Why?
The second. It shows product judgement, keeps you in control of the clock, and gives the interviewer something concrete to correct. Open questions push the work back onto the interviewer and often lead to a vague or sprawling scope.
Scenario: the interviewer asks, "What happens when someone with 400M followers posts?" What is this question really testing, and which step of the framework are you in?
It's a hint that naive fan-out-on-write fails for celebrities (400M timeline writes for one post). It's testing technical depth and adaptability — you're in step 5 (deep dive on the feed) or step 6 (bottlenecks). A good answer: switch to hybrid fan-out — pull celebrity posts at read time and merge with the pushed timeline.
Why should you design the API before the high-level architecture?
The API makes the use cases concrete: each endpoint implies a service that handles it and data it must read or write. Writing GET /feed?cursor immediately raises "where does the feed come from, and how is it paginated?", which shapes the feed service, the timeline cache and the data model.
Name four rubric dimensions interviewers commonly use, and one behaviour that scores well on each.
Problem navigation — proposing a scope and confirming it. Solution design — a complete end-to-end design covering every core requirement. Technical depth — explaining the mechanics of fan-out or sharding with numbers. Trade-offs — comparing push vs pull and naming the cost of the choice. (Also: communication — thinking aloud and checking in; operational awareness — discussing failures and monitoring.)
Which lessons of this guide would you study to prepare for step 6 (bottlenecks & trade-offs)?
Core Principles (SPOFs, availability math, tail latency), CAP & Consistency, Resilience Patterns, Multi-Region and Observability — plus Caching and Sharding for hot-spot mitigations.
- Use the 6 steps: requirements → estimation → API → data model + high-level design → deep dives → bottlenecks & wrap-up. Each step feeds the next.
- Budget time: ~13 min scoping, ~12 min breadth, ~15 min depth, ~5 min wrap-up — and say your checkpoints out loud.
- Breadth before depth: a complete simple design first, then 2–3 deep dives chosen with the interviewer.
- Make your thinking visible: think aloud, propose rather than ask, state assumptions, check in.
- Discuss trade-offs as options → criteria → decision with numbers → cost → mitigation.
- Every box in the Instagram diagram traces back to a requirement, a number or a bottleneck — be able to say which.
Related lessons
- Requirements — step 1 in depth, including the full list of clarifying questions
- Back-of-the-Envelope Estimation — step 2, with a complete worked Instagram example
- API Design — step 3: REST, gRPC, GraphQL, WebSockets, pagination, idempotency
- Core Principles — the vocabulary for step 6: scalability, availability, latency
- CAP & Consistency — how to discuss consistency trade-offs per feature
- News Feed — the most common Instagram deep dive
- Full Interview Walkthrough — the framework applied to Instagram, minute by minute