1Context and scope
Instagram is a read-heavy social product built around media. People open their feed many times a day but post rarely, so the design spends work at write time to make reads cheap: each new post is written into followers’ precomputed timelines, and a feed load reads one list, ranks it and returns a page. Photos and videos are almost all of the bytes; they are processed once at upload into several renditions and then served from a CDN. Accounts with a hundred million followers, a burst of likes on one post and expiring stories each break the simple version of the design. This doc walks through the hour the way an interviewer expects, with numbers you can defend and a simulated slice you can break.
2Clarifying questions
- Which features are in scope?
- Posting photos and videos, the home feed, likes, comments, follows, profiles and stories. Reels, Explore, search, DMs and ads are out of scope.
- How many users, and how active?
- Assume 500 million daily active users opening the feed about 10 times a day: about 58,000 feed loads a second, 116,000 at peak.
- How many posts, and how big?
- Assume 100 million posts a day (about 1,160 a second). A photo is about 1.5 MB as uploaded; videos are larger and are transcoded separately.
- What does the follower distribution look like?
- About 200 followers on average, heavily skewed: a few accounts have more than 100 million. That skew drives the fan-out design.
- Is the feed chronological or ranked?
- Ranked by predicted interest, from accounts the viewer follows. Chronological ordering is the fallback when ranking is unavailable.
- How fresh must the feed and counts be?
- A new post should reach followers within seconds; counts may lag by a few seconds. The author must see their own post at once.
- Are there private accounts?
- Yes: only approved followers may see their posts and stories, and that check must never be served stale.
- One region or many?
- Design for one region with a CDN worldwide; discuss multi-region as a follow-up.
3Goals and non-goals
Goals
- Post a photo or video with a caption: upload the media, process it into renditions in the background, and show the post to followers within seconds.
- Load the home feed: posts from followed accounts, ranked for the viewer, paginated with a cursor, p99 under 250 ms on the server side.
- Serve photos and videos from a CDN in the size the device needs.
- Like, comment and follow: the action is saved at once; counts may lag by seconds.
- Profile page: bio, counts and a grid of the account’s posts.
- Stories: posts that expire 24 hours after they are made, shown in a tray at the top of the feed.
- Private accounts: only approved followers see their posts and stories.
Non-goals
- Reels and Explore recommendations from accounts you do not follow (mentioned only as a different retrieval source).
- Direct messages, live video, search and ads.
- Content moderation and spam models, beyond keeping scrapers and bots at the edge.
- Multi-region active-active writes and data residency.
5Capacity estimate
| Quantity | Value | How |
|---|---|---|
| Daily active users | 500 million (assumed) | An assumption for the exercise; Meta said in early 2019 that Stories alone had 500 million daily users. |
| Feed loads | ≈ 58,000/s average, ≈ 116,000/s peak | 500M × 10 loads a day ÷ 86,400 s; the evening peak is about 2× the average. |
| New posts | ≈ 1,160/s | Assume 100 million posts a day ÷ 86,400 s. |
| Photo storage | ≈ 250 TB a day | 100M × 2.5 MB (original about 1.5 MB plus about 4 renditions about 1 MB), before replication or erasure coding. |
| Fan-out writes | ≈ 232,000/s | 1,160 posts/s × 200 average followers. One 100M-follower post alone would be 100M writes: celebrities are pulled, not pushed. |
| Timeline cache | ≈ 2 TB of IDs | 500M timelines × 500 post IDs × 8 bytes; about twice that with Redis overhead. |
| Photo egress | ≈ 930 Gbps average | 500M users × 100 photos a day × 200 KB = 10 PB a day; video adds far more. |
| Simulated slice | 2,500 req/s | 1,000 media fetches, 625 feed loads, 300 stories trays, 300 likes/comments/follows, 200 profiles, 75 posts; writes are over-represented on purpose. |
| Reference design | ≈ $18,900/month (budget $26,000) | Bot management (per request, about $7,800) and the two CDN tiers (about $2,700) are the largest lines. |
The rest of the doc
Non-functional requirements · API · Data model · The design · Deep dives · Key concepts · Alternatives considered · Failure modes and fixes · Interviewer follow-ups · Common mistakes · What a strong answer covers · Try it in the lab · Check yourself · Further reading
Unlock “Instagram: the full interview”
The full interview: clarifying questions, estimates, API, data model, the design, deep dives with trade-offs, follow-ups, common mistakes and a rubric. Unlocking it also unlocks the build problem in the lab. Paid once, on your account.