Lesson Overview + Section #01 + RESHADED Checklist + Quiz #1 are unlocked free below (no login required). Unlock all 80 HD video lessons and deep-dive sections — or watch our two free sample video lessons first.
Designing Twitter requires building a low-latency global broadcast platform under a 10:1 read-to-write asymmetry (58,000 timeline reads/sec versus 5,800 tweets/sec) and extreme power-law social graph skew, where ordinary accounts have ~200 followers while celebrities exceed 100,000,000. A single 280-character post must be persisted durably once, indexed for real-time search, and delivered across millions of personalized home timelines within seconds. L4–L6 interviewers probe four architectural pillars: coordination-free 64-bit Snowflake ID generation, hot-spot-free storage sharding, hybrid push/pull fan-out, and Finagle-style client-side load balancing across internal microservice meshes.
Generate k-sorted, globally unique 64-bit Snowflake IDs (41-bit timestamp, 10-bit worker, 12-bit sequence) to support coordination-free sharding and drift-free cursor pagination.
Resolve the 100M-follower celebrity fan-out bottleneck by combining asynchronous Redis fan-out-on-write for regular users with read-time merge (fan-out-on-read) for high-follower accounts.
Eliminate internal L7 proxy bottlenecks and full-mesh TCP explosion using Finagle client-side load balancing (Power of Two Choices + EWMA latency) with Deterministic Ring Aperture.
Follow this exact sequence from the Intro narration on every system design prompt so you never miss requirements, math, contracts, or the 13-minute deep dive.
0 / 8 Checked
RRequirements & ScopeMin 2–8
Clarify who the users are, 3–4 core functional flows, explicit non-goals, and target latency/availability SLAs before drawing a single box.
Avoid trap: Still gathering requirements at minute 15 squeezes the deep dive where L5/L6 offers are decided.
EBack-of-the-Envelope MathMin 8–12
Compute ONLY numbers that actively change architectural choices: DAU → peak read/write RPS, daily & 5-year storage, bandwidth (or tokens/sec & KV-cache VRAM for AI).
Avoid trap: Spending 10 minutes multiplying irrelevant byte counts that never influence sharding or caching.
SStorage & Data ModelMin 12–15
Define core tables, primary/partition keys, and access indexes. Separate small structured metadata rows (~1 KB) from bulk binary blobs (S3 + CDN).
Avoid trap: Picking Cassandra or NoSQL by buzzword when 40 writes/s & 3 TB fit cleanly on one indexed SQL primary + replicas.
AAPIs & Wire ContractsMin 15–17
Write 3–4 concrete REST/gRPC/SSE/WebSocket endpoints with request/response shapes, cursor pagination, and Idempotency-Key headers on mutations.
Avoid trap: Hand-waving client-server contracts and discovering missing parameters halfway through the deep dive.
HHigh-Level DesignMin 17–27
Draw the simplest end-to-end working read and write paths first. Every box on the board must trace back to a stated requirement or number.
Avoid trap: Reciting a memorized 12-microservice Kafka mesh before proving why a simpler synchronous path breaks.
DDetailed Design (Deep Dive)Min 27–36
Proactively audit your high-level diagram, name the top 2 bottlenecks (hot partitions, fan-out skew, lock contention, GPU saturation), and go deep on internals.
Avoid trap: Waiting passively for the interviewer to rescue pacing or skimming every box at shallow surface depth.
EEvaluation & Failure ModesMin 36–41
State what each architectural choice COSTS you, and trace graceful degradation when cache, queue, external vendor, or primary DB fails.
Avoid trap: Assuming happy-path uptime or placing slow 3-second external calls inline on revenue-critical write paths.
DDistinctive FeatureMin 41–45
Solve the signature hard problem unique to this prompt (e.g., double-entry ledger idempotency, Geohash dispatch locks, OT/CRDT sync, or SSE token streaming).
Avoid trap: Spending 20 minutes on generic login/CRUD tables and zero time on the core distributed challenge.
INTERVIEWER SCORECARD · WHAT MAKES A STRONG HIRE?
5 Signals Bar Raisers Grade (L4 vs. L5 Senior vs. L6 Staff)
Senior (L5 / E5 / Senior SDE) Bar — Autonomous Pacing, Depth & Proactive Trade-Offs: Owns the 45-minute clock without prompting, derives every component quantitatively, surfaces failure modes (hot shards, stampedes, dual writes) BEFORE being asked, and defends consistency vs. latency trade-offs.
1. Scoping
✓ STRONG HIRE SIGNAL
Clarifies users, read/write skew, p99 latency, consistency bounds, and explicit non-goals in minutes 2–8.
✗ NO-HIRE RED FLAG
Jumps straight into drawing load balancers and microservices at minute 2 without asking a single question.
2. Right-Sized Design
✓ STRONG HIRE SIGNAL
Starts with the simplest working architecture justified by the math (e.g., 1 NVMe SQL primary + replicas + Redis for 40 writes/s & 3 TB).
✗ NO-HIRE RED FLAG
Recites a memorized Kafka + multi-DC Cassandra diagram that contradicts their own traffic calculations.
3. Technical Depth
✓ STRONG HIRE SIGNAL
Drives deep into 1–2 hard bottlenecks (partition keys, hot-key mitigation, transactional outbox, KV-cache batching) at minute 27.
✗ NO-HIRE RED FLAG
Skims across 12 boxes at identical buzzword depth and runs out of time before the deep dive.
4. Explicit Trade-Offs
✓ STRONG HIRE SIGNAL
Uses 3-part reasoning: 'A queue here because SMTP spikes to 3 s; checkout stays <60 ms, and we accept eventual email delay + retry dedup.'
✗ NO-HIRE RED FLAG
Name-drops tools ('We put Kafka and ZooKeeper here') without stating the alternative or operational cost.
5. Communication
✓ STRONG HIRE SIGNAL
Thinks aloud every 30–45s, checks alignment at phase transitions, and treats 'What if X fails?' as a cue for where points are awarded.
✗ NO-HIRE RED FLAG
Goes silent for 5 minutes while drawing or defends a flawed assumption defensively when nudged.
ARCHITECTURE & DATA-FLOW SLIDES · SLIDE 1 OF 1Section 01: System Design: Twitter
ARCHITECTURE / DATA FLOW DIAGRAM
SECTION 01 OF 5
1. System Design: Twitter
★ FREE PREVIEW
Key Takeaway: Twitter is an asymmetric fan-out system where a single directional write must rapidly materialize across millions of home timelines despite extreme follower-count skew.
ARCHITECTURE / DATA FLOW DIAGRAM
Directional Social Graph & Real-Time Broadcast
On Twitter, users publish short messages up to 280 characters (optionally referencing photos or video) and follow other accounts via a directed (one-way) graph—unlike mutual friend networks that enforce symmetric edges and cap connections at 5,000. Because following requires no reciprocation, a single news outlet or public figure can accumulate 100,000,000+ followers. Every time a user opens the app, their home timeline aggregates recent tweets from hundreds of followed accounts into a time-ordered or ranked stream alongside lightweight engagement counters (likes, retweets, replies).
Read-Heavy Consumption: Users refresh and scroll their home timeline roughly 10x more frequently than tweets are authored across the platform.
Power-Law Fan-Out Skew: One write from an ordinary account updates ~200 timelines; one write from a top-tier celebrity reaches 100,000,000 followers.
Real-Time Freshness SLA: Breaking news and live-event commentary lose value rapidly if delivery lags beyond 2–5 s.
Core Architectural Tensions
Every design decision in Twitter balances write amplification against read amplification. Computing home timelines purely at read time (SELECT ... WHERE author_id IN (...)) collapses under 58,000 reads/sec, whereas precomputing timelines purely at write time collapses whenever an account with 100M followers posts. Solving both simultaneously requires decoupling write persistence from timeline materialization and adapting the delivery strategy per author.
System Property
Workload Reality
Naive Design Failure Mode
Production Engineering Pattern
Read-to-Write Ratio
10:1 (58K timeline reads/s vs. 5.8K writes/s)
On-demand SQL joins across 500 followees per read saturate DB IOPS
Precompute 8-byte tweet ID lists in RAM (Timeline Cache) + Tweet Cache
Follower Skew
200 average followers vs. 100,000,000 max
Unconditional push triggers 100M cache writes (~100 s lag) on 1 celebrity tweet
Hybrid fan-out: push ordinary authors on write, merge celebrity authors on read
Media Payload Size
300 B tweet text vs. 200 KB photo / 3 MB video
Serving binary blobs through core API servers exhausts origin NICs
Store immutable blobs in object storage (S3) fronted by global edge CDN
East-West RPC Volume
Millions of internal calls/sec hydrating tweets and profiles
Centralized internal L7 proxies add extra network hops and failure domains
Client-side RPC load balancing (Finagle) with Power of Two Choices + Deterministic Aperture
SECTION 02 OF 5
2. Requirements of Twitter's Design
🔒 PRO SECTION
Key Takeaway: Optimize for high availability (AP), sub-200 ms server-side timeline latency, and zero tweet loss while accepting multi-second eventual consistency, backing the 58K RPS read workload with multi-tier RAM caches and a 93 Gbps CDN tier.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Key Takeaway: Persist each tweet once in a sharded store, push only 8-byte tweet IDs into per-user timeline caches asynchronously via a queue, and serve timeline reads through a two-level memory cache backed by edge CDNs.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Key Takeaway: Embedding Finagle load balancing inside each RPC caller eliminates middlebox hops, while pairing Power of Two Choices (P2C) with Deterministic Ring Aperture bounds TCP connections and prevents random-subset server clumping.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.