TL;DR

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:

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.

🧠 Analogy An architect asked to "design a house" does not start by choosing tiles. First they ask: How many people will live here? What's the budget? Which city — earthquakes, snow? (requirements). Then they size it: 4 bedrooms, ~200 m², a 10 kW electrical supply (estimation). Then they agree the interfaces with the client: where are the doors, which rooms connect (API). Then a floor plan (high-level design), then detailed drawings of the tricky parts — the staircase, the cantilevered balcony (deep dives) — and finally a review of risks and costs: "if the budget is cut, we drop the basement" (trade-offs). The system design framework is exactly the same discipline applied to software.

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 1Clarifyrequirements Step 2Estimatescale Step 3Definethe API Step 4Data model +high-level Step 5Deepdives Step 6Bottlenecks& wrap-up 45-minute timeline (minutes) ~5 ~4 ~4 ~12 ~15 ~5 05913254045 Scoping (steps 1–3) ≈ 13 min · Breadth (step 4) ≈ 12 min · Depth + wrap-up ≈ 20 min
The six steps and a typical 45-minute budget. The bar widths are proportional to time: most of the interview is design and deep dives, not scoping.
StepQuestion it answersArtifact you leave on the boardLesson(s) in this guide
1. Clarify requirementsWhat exactly are we building, for whom, and how good must it be?A short list of in-scope features + non-functional targetsRequirements
2. Estimate scaleHow big is it? Reads vs writes? Bytes per day?QPS, storage, bandwidth, cache size — 5–8 numbersBack-of-the-Envelope Estimation
3. Define the APIHow do clients talk to the system?5–8 endpoint signaturesAPI Design
4. Data model + high-level designWhat are the entities, where are they stored, which components exist?Tables/keys + a box-and-arrow diagramDatabases, Microservices
5. Deep divesHow do the hardest parts actually work at scale?Zoomed-in diagrams, algorithms, sequence flowsNews Feed, Media Upload, …
6. Bottlenecks & wrap-upWhat breaks first? What did we trade away? What next?A list of risks, mitigations and future workCore 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:

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

CategoryQuestionWhy it changes the design
Users & scaleHow many daily active users? Global or one country?1M DAU fits on a single database; 500M DAU needs sharding, caching and multiple regions.
ContentPhotos only, or video too? Max file size?Video adds transcoding, adaptive streaming and ~10× more storage and bandwidth.
FeedChronological or ranked? How fresh must it be?Ranking needs an ML pipeline; freshness decides push vs pull fan-out.
GraphIs following one-way? Are there celebrities with 100M+ followers?Celebrities break naive fan-out-on-write (the "hot key" problem).
LatencyWhat feed load time is acceptable?A p99 of 200 ms forces pre-computed timelines in memory.
ConsistencyIs it OK if a like count is briefly stale?"Yes" lets you use eventually consistent counters — see CAP & consistency.
PrivacyPrivate 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:

💡 Keep it short Some interviewers skip estimation entirely ("assume it's big"). Offer it — "shall I do some quick math on scale?" — and keep it under five minutes. Only compute numbers you will use later. The full technique, and a complete worked Instagram example, is in Back-of-the-Envelope Estimation.

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:

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.

EntityKey fieldsMain access patternStore (why)
Useruser_id, username (unique), name, bio, is_privateLookup by id / by username; uniqueness on signupPostgreSQL, sharded + replicas (strong uniqueness, relational)
Postpost_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
Mediabytes of each renditionFetch by URLObject storage (S3) + CDN
Followfollower_id, followee_id, created_at"Who does X follow?", "Who follows X?"Graph store; edges stored in both directions
Like / Commentpost_id, user_id, (text), created_atCount per post; "did I like it?"; latest commentsCassandra + counters in Redis
Timelineuser_id → list of post_idsRead the top N quicklyRedis (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:

  1. Client → load balancer → API gateway → services. One sentence each: the load balancer spreads traffic; the gateway does TLS, auth and rate limiting.
  2. Split services by responsibility: Upload, Feed, Follow/Graph, Like & Comment, User. Make them stateless so they scale horizontally.
  3. Attach a data store to each, using the table above.
  4. 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.
  5. 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.
📱 Appupload
→pre-signed PUT
S3original
→create post
Upload svcmetadata
→event
Kafkapost.created
→consume
Fan-out / media workers
→write
Redis timelines+ renditions in S3
⚠️ Breadth before depth Do not go deep on any single box in this step. A complete but shallow design at minute 25 is far better than a perfect upload pipeline and no feed. If the interviewer pulls you into detail early, answer briefly and say "let me finish the end-to-end picture first and come back to this in the deep dive."

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

BREADTH — step 4: end-to-end design that covers every core requirement clients · edge · gateway · services · data stores · async pipeline · CDN DEPTH 1 Feed fan-out push vs pull celebrities Redis sizing ranking DEPTH 2 Media pipeline pre-signed URLs transcoding CDN delivery DEPTH 3 Sharding if time allows A "T-shaped" interview: one wide, shallow pass, then 2–3 deep vertical drills chosen with the interviewer.
Breadth first (the horizontal bar), then depth on the parts that matter most (the vertical bars).

7.1 How to run a deep dive

  1. Ask or propose: "I think the feed is the most interesting part — shall I go deep there, or would you prefer the upload pipeline?"
  2. 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."
  3. Present 2+ options with a comparison (fan-out on write vs on read).
  4. 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").
  5. Walk through failure cases: what if a fan-out worker crashes mid-way? (Kafka offsets → retry; idempotent writes to timelines.)
  6. 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.

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:

MinutesPhaseGoalIf you are running late…
0–2Introductions / restate the problemConfirm what is being askedSkip small talk; restate in one sentence
2–71. RequirementsScope + 5–6 non-functional targetsPropose a scope and ask "OK?" rather than asking open questions
7–112. EstimationQPS, storage, bandwidth, read:write ratioGive 3 numbers verbally; skip the rest
11–153. APICore endpointsWrite only the feed + upload endpoints
15–274. Data model + high-level designComplete end-to-end diagramDraw it, describe read and write paths in two sentences each
27–405. Deep dives2–3 components in depthDo one deep dive well instead of three badly
40–456. Bottlenecks & wrap-upRisks, trade-offs, summary; questionsNever skip the 60-second summary
💡 Use checkpoints Glance at the clock at the end of each step. A good habit is saying "we're about 15 minutes in, so let me move to the high-level design." It shows the interviewer you are managing the session — a senior-level behaviour in itself. If the interviewer explicitly steers you ("skip the estimates, let's talk about the feed"), follow them immediately; the budget is a default, not a rule.

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.

DimensionWhat a strong signal looks likeWhat a weak signal looks like
Problem navigation / scopingAsks targeted questions, proposes a scope, prioritises core features, identifies the hard parts earlyStarts drawing immediately; tries to design everything; never confirms assumptions
Solution design (breadth)A complete, coherent, working end-to-end design; components have clear responsibilitiesDisconnected boxes; requirements left unaddressed; data flow unclear
Technical depthExplains how components work (partition keys, cache eviction, fan-out mechanics), with numbersBuzzwords ("use Kafka") without mechanics; hand-waving at the first follow-up
Trade-off reasoningCompares alternatives, picks one with justification, names what was sacrificedPresents one option as obviously correct; cannot say what it costs
Scalability & operationsFinds bottlenecks and SPOFs; thinks about failures, monitoring, deploymentAssumes nothing fails; no awareness of hot spots
Communication & collaborationThinks aloud, structured, checks in, adapts to hints, handles pushback calmlyLong silences; monologue; ignores hints; defensive

10.1 How expectations change by level

LevelTypical expectation
Junior / new gradOften no system design round, or a simpler one. Reasonable high-level design with some guidance.
Mid-levelComplete high-level design on their own; one solid deep dive; knows standard building blocks.
SeniorDrives 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

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:

Optionsname 2–3
→
Criteriafrom requirements
→
Decision+ numbers
→
Costwhat we give up
→
Mitigation / revisitwhen it changes

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:

AxisInstagram exampleLesson
Consistency vs availability / latencyEventually consistent like counts vs strongly consistent usernamesCAP & Consistency
Read cost vs write costPush fan-out (cheap reads, costly writes) vs pullNews Feed
Latency vs costKeeping timelines in RAM vs on diskCaching
Simplicity vs scalabilityOne PostgreSQL vs sharded clustersSharding
Sync vs asyncTranscode during upload request vs via a queueMessage Queues
Freshness vs efficiencyShort vs long cache TTLs; CDN invalidationCDN
Build vs buyOwn CDN vs commercial CDNCDN

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

  1. 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…).
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Drill estimation separately. Five-minute daily drills ("how much storage do 1B tweets need?") build fluency with powers of ten — see Estimation.
  8. 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:

StageLessons (in order)You will be able to…
1. FoundationsHow to Approach → Requirements → Estimation → Core Principles → CAP & ConsistencyScope a problem, size it, and speak the vocabulary of trade-offs
2. Edge & networkingNetworking → Clients → DNS → CDN → Load Balancing → API Gateway → Rate Limiting → AuthExplain how a request gets from a phone to a server, safely and fast
3. Data layerDatabases → Indexing → Replication → Sharding → Consistent Hashing → Caching → Object Storage → ID GenerationChoose and scale storage for any access pattern
4. Async processingMessage Queues & Kafka → Media Processing → Notifications → Analytics & MLDecouple work with events and background workers
5. ServicesAPI Design → Microservices → Upload → Social Graph → News Feed → Likes → Stories → Search → DMsDesign each Instagram feature in depth
6. OperationsResilience → Observability → Multi-Region → SecurityKeep it running, measurable and safe
7. Put it togetherRequest Flows → Full Interview Walkthrough; keep the Glossary handyDeliver the whole design in 45 minutes
💡 Study tips for each lesson Read the TL;DR first, then the body. Try to answer every "Check your understanding" question before expanding it. Mark the lesson as learned only when you can explain its diagram to someone else from memory. If you have limited time (e.g. an interview next week), do Stage 1, then News Feed, Caching, Sharding, Message Queues, CDN, and finish with the Interview Walkthrough.

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.

media bytes via CDN 📱 Mobile / Web DNS Load Balancer API Gateway CDN (edge) Upload Stories Like/Cmt Follow Feed Search DM User/Auth Kafka event bus (post.created · like · comment · follow · story.created) Fan-out workers Media workers Search indexer Notifications Analytics & ML services and workers read/write the data stores below Cassandraposts/comments Graph storefollows Redisfeeds/counters Elasticsearchsearch index PostgreSQLusers MessagesDMs S3 objectsphotos/video origin pull 1 2 2 3 4 4 5 5 5 6 6 ① scope decides which boxes exist ② numbers justify CDN, Kafka, shard counts ③ API defines gateway routes ④ entities → services + stores ⑤ deep dives: feed, fan-out, media ⑥ bottlenecks: redundant LB, cache replicas
The Instagram architecture annotated with the framework step that produces each part.
StepWhat it produces in the Instagram diagramLessons that teach it
① RequirementsWhich 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
② EstimationWhy 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
③ APIThe routes on the API Gateway; REST vs WebSocket; pre-signed upload URLs.API Design, API Gateway, Auth, Rate Limiting
④ Data model + HLDThe 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 divesFan-out workers + Redis timelines, media workers + renditions, sharded counters, WebSocket gateways.News Feed, Upload, Processing, Likes, Graph, DMs, Search, Stories
⑥ Bottlenecks & trade-offsReplicas 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
📸 In Instagram Instagram's real history is a lesson in the framework applied over time. Public engineering talks describe a tiny team launching in 2010 on a simple stack (Django + PostgreSQL + Redis/Memcached on cloud servers) — the right design for those requirements. As requirements changed (tens of millions of users within two years, video, Stories, DMs), the numbers changed, and the design evolved: PostgreSQL was sharded into thousands of logical shards with 64-bit time-ordered IDs, Cassandra was adopted for high-write workloads, and the system moved into Facebook's data centres. The lesson: the design follows from requirements and numbers. In an interview, you are showing that you could make each of those decisions for the right reason at the right time.

When you get "Design Instagram" in an interview, a strong performance in this guide's terms is:

  1. Scope to upload + follow + feed + like/comment, flag Stories/DMs/search as extended (Requirements).
  2. Size it: ~1K uploads/s, ~100–300K feed reads/s, hundreds of TB/day media, PB/day egress (Estimation).
  3. Write 6–8 endpoints with cursor pagination and pre-signed uploads (API Design).
  4. Draw the diagram top to bottom: clients, edge, services, Kafka, workers, stores, CDN (Request Flows).
  5. Go deep on the feed (hybrid fan-out, Redis sizing, ranking) and media pipeline (News Feed, Media Processing).
  6. 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)

18. Real-world technologies

In the interview you'll name concrete technologies. Use this "default toolbox" — and always say why:

NeedTypical choicesReach for it when…
Traffic distributionDNS (Route 53), L4/L7 load balancers (NGINX, HAProxy, Envoy, cloud LBs)Always — more than one server
Edge for static mediaCDN (CloudFront, Akamai, Cloudflare, Fastly)Large, cacheable, globally-read content
Relational / strongly consistent dataPostgreSQL, MySQL (+ Vitess/Citus for sharding), Spanner/CockroachDBUniqueness, transactions, relations (users, accounts)
High-write, wide-column dataCassandra, ScyllaDB, HBase, DynamoDBHuge write volume, simple key-based access (posts, likes, messages)
Cache / in-memory structuresRedis, MemcachedHot reads, timelines, counters, sessions
Blob storageAmazon S3, GCS, Azure Blob, CephPhotos, videos, backups — anything large and immutable
Event streaming / queuesKafka, Pulsar, Kinesis, RabbitMQ, SQSAsync work, fan-out, decoupling producers and consumers
SearchElasticsearch, OpenSearch, SolrFull-text and typeahead search
CoordinationZooKeeper, etcdLeader election, config, service discovery
Batch / MLSpark, Flink, data warehouses, feature storesAnalytics, ranking model training
Whiteboarding (practice)Physical whiteboard, Excalidraw, draw.io, any shared docMock 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.

🎯 Key takeaways

Related lessons