System Design Interview Questions: 50 Problems With Answer Outlines (2027 Edition)
A free list of the 50 system design interview questions that come up most in public interview write-ups, each with a structured answer outline: what to clarify, rough numbers, API, data model, high-level design, deep dives and the trade-offs interviewers probe. Use it to practice for senior software engineer, backend and staff-level system design interviews at big tech and startups, or to run mock interviews with a friend.
Last reviewed: December 2026.
These outlines are starting points, not scripts. Interviewers care far more about how you reason through requirements and trade-offs than about reaching one “correct” architecture. Every outline was written from scratch for this repo; links point to free, public engineering write-ups and papers so you can see how real companies solved the same problems.
Table of contents
- How to use this list
- The answer framework (45-minute version)
- Back-of-the-envelope cheat sheet
- Building blocks you should know cold
- Question index
- Part 1: Core infrastructure (1-12)
- Part 2: Social, content and media (13-22)
- Part 3: Messaging and real-time (23-29)
- Part 4: Location and marketplaces (30-35)
- Part 5: Commerce and money (36-41)
- Part 6: Data, search and analytics (42-46)
- Part 7: AI-era systems (47-50)
- What interviewers expect by level
- Common mistakes
- 4-week study plan
- Best resources
- FAQ
- Where to go next
- Contributing
How to use this list
- Do not read the outline first. Pick a question, set a 45-minute timer, and talk through it out loud (or on a whiteboard tool like Excalidraw). Then compare with the outline.
- Start with the starred questions. The ones marked ★ in the index are the classics that teach the most reusable ideas (caching, sharding, fan-out, queues, idempotency). If you only have a week, do those.
- Go one level deeper than the outline. Each outline lists deep dives. Pick one and explain it for five minutes with numbers. That is what separates senior answers from mid-level ones.
- Read one real write-up per question. The “Real-world reading” line links a public engineering post or paper on the same problem.
- Practice with a partner. System design is a conversation. Free peer mocks exist (see resources); one mock with feedback beats five solo readings.
The answer framework (45-minute version)
Most system design rounds are 45 to 60 minutes. A simple structure keeps you from spending 30 minutes on the database schema and never reaching scale.
| Step | Time | What you do | What the interviewer is checking |
|---|---|---|---|
| 1. Requirements | 5 min | Functional requirements (3-5 core features), non-functional (latency, availability, consistency, durability), explicit out-of-scope list | Can you scope an ambiguous problem? |
| 2. Estimates | 3-5 min | Users, QPS (read vs write), storage per year, bandwidth. Only the numbers that change the design | Do you know which numbers matter? |
| 3. API | 3-5 min | 3-6 endpoints or RPCs with key parameters; mention pagination, idempotency keys, auth | Clear contracts, client thinking |
| 4. Data model | 5 min | Core entities, keys, access patterns, choice of store | Do you pick storage based on access patterns? |
| 5. High-level design | 10 min | Boxes and arrows: clients, gateway, services, stores, caches, queues. Walk one read and one write path | A working end-to-end design |
| 6. Deep dives | 10-15 min | 2-3 hardest parts: hot keys, fan-out, consistency, failure handling | Depth, trade-offs, real experience |
| 7. Wrap-up | 2-3 min | Bottlenecks, monitoring, what you would do next | Self-awareness, ownership |
Phrases that help: “Let me confirm the scope before I design”, “I’ll assume X; tell me if that’s wrong”, “The trade-off here is…”, “If this becomes the bottleneck, I’d…”.
Back-of-the-envelope cheat sheet
You do not need precise math, just the right order of magnitude.
Time conversions
| Quantity | Approximation |
|---|---|
| Seconds in a day | 86,400, round to 10^5 |
| 1 million requests/day | about 12 requests/second |
| 100 million requests/day | about 1,200 requests/second |
| 1 billion requests/day | about 12,000 requests/second |
| Peak traffic | assume 2-3x the average (more for flash events) |
Sizes
| Item | Rough size |
|---|---|
| A UUID / 128-bit ID | 16 bytes |
| A 64-bit integer ID or timestamp | 8 bytes |
| A short text post with metadata | 0.5-1 KB |
| A compressed photo | 200 KB - 2 MB |
| One minute of 1080p video | tens of MB (depends heavily on codec and bitrate) |
| 1 KB x 1 billion | 1 TB |
Latency (orders of magnitude; see Latency Numbers Every Programmer Should Know for the classic table)
| Operation | Order of magnitude |
|---|---|
| Main memory reference | ~100 ns |
| Read from SSD (random) | tens to ~100+ µs |
| Round trip inside a datacenter | ~0.5 ms |
| Cache hit over the network (Redis/Memcached) | sub-millisecond to ~1 ms |
| Indexed database read | ~1-10 ms |
| Cross-continent round trip | ~100-150 ms |
Rules of thumb
- A single well-tuned relational database primary handles thousands to tens of thousands of simple queries per second; beyond that, add read replicas, caching, then sharding.
- A single Redis node can serve on the order of 100,000 simple operations per second.
- Cache when the read:write ratio is high and slight staleness is acceptable.
- Kafka-style logs turn spiky writes into smooth, replayable streams.
Building blocks you should know cold
| Block | Use it for | Watch out for | Free reading |
|---|---|---|---|
| Load balancer (L4/L7) | Spreading traffic, health checks, TLS termination | Sticky sessions, uneven load | Google SRE: load balancing in the datacenter |
| Cache (Redis, Memcached, CDN) | Hot reads, session data, computed results | Invalidation, stampedes, hot keys | Scaling Memcache at Facebook |
| Relational DB (PostgreSQL, MySQL) | Transactions, joins, strong consistency | Write scaling, schema migrations | PostgreSQL docs |
| Wide-column / KV (Cassandra, DynamoDB) | Massive write throughput, simple access patterns | No ad-hoc joins, model per query | Dynamo paper, Cassandra paper |
| Document DB (MongoDB) | Flexible nested records | Cross-document transactions, shard key choice | MongoDB sharding docs |
| Object storage (S3, GCS) | Blobs: images, video, backups | Not for small, frequently updated records | Dropbox Magic Pocket |
| Message queue / log (Kafka, SQS, Redis Streams) | Decoupling, buffering, async work, event sourcing | Ordering, duplicate delivery, backlog | Kafka docs, Redis Streams |
| Search index (Elasticsearch, OpenSearch) | Full-text search, faceting | Index lag, cluster ops | Elasticsearch reference |
| Consistent hashing | Spreading keys across nodes with minimal reshuffle | Virtual nodes for balance | Consistent hashing |
| Consensus (Raft, Paxos, ZooKeeper, etcd) | Leader election, config, locks | Latency, operational complexity | Raft |
| Probabilistic structures | Bloom filters, HyperLogLog, Count-Min Sketch | Approximate answers | Bloom filter, HyperLogLog, Count-Min Sketch |
| Retries, timeouts, backoff | Surviving partial failure | Retry storms | AWS Builders’ Library: timeouts, retries and backoff with jitter |
Question index
Levels: M = mid-level friendly, S = senior, St = staff-leaning. ★ = start here.
| # | Question | Level | Key ideas |
|---|---|---|---|
| 1 | ★ URL shortener | M | ID generation, base62, cache, redirects |
| 2 | ★ Rate limiter | M | Token bucket, sliding window, Redis, distributed counters |
| 3 | ★ Distributed key-value store | S | Partitioning, replication, quorum, conflict resolution |
| 4 | ★ Distributed cache | S | Eviction, consistent hashing, hot keys, stampede |
| 5 | Unique ID generator | M | Snowflake IDs, clock skew, ordering |
| 6 | ★ Message queue | S | Partitions, consumer groups, offsets, delivery semantics |
| 7 | Distributed job scheduler | S | Leasing, at-least-once, cron, idempotent jobs |
| 8 | Notification service | M | Fan-out, channels, preferences, retries |
| 9 | API gateway | S | Auth, routing, rate limits, observability |
| 10 | Distributed lock service | St | Leases, fencing tokens, consensus |
| 11 | Metrics and monitoring system | S | Time series storage, downsampling, alerting |
| 12 | Centralized logging system | S | Ingestion, indexing, retention tiers |
| 13 | ★ News feed (Facebook/X timeline) | S | Fan-out on write vs read, ranking, celebrities |
| 14 | Instagram (photo sharing) | S | Object storage, CDN, feed, thumbnails |
| 15 | ★ YouTube / video streaming | S | Transcoding pipeline, adaptive bitrate, CDN |
| 16 | Netflix (video on demand at scale) | St | Edge caching, catalog, personalization |
| 17 | Spotify (music streaming) | S | Audio delivery, playlists, offline |
| 18 | Pastebin | M | Blob storage, expiry, short IDs |
| 19 | ★ Google Drive / Dropbox | S | Chunking, dedup, sync, conflict handling |
| 20 | ★ Google Docs (collaborative editing) | St | OT vs CRDT, presence, versioning |
| 21 | Comment system with nested replies | M | Tree storage, pagination, counts |
| 22 | Like/view counter at scale | S | Sharded counters, batching, approximate counts |
| 23 | ★ Chat app (WhatsApp/Messenger) | S | WebSockets, delivery receipts, offline sync |
| 24 | Group chat / Slack | S | Channels, fan-out, unread counts, search |
| 25 | Live comments on a stream | S | Pub/sub, fan-out to millions, sampling |
| 26 | Presence (online/offline status) | M | Heartbeats, TTLs, fan-out limits |
| 27 | Video conferencing (Zoom) | St | WebRTC, SFU vs MCU, regional media servers |
| 28 | Collaborative whiteboard | S | Real-time sync, CRDTs, snapshots |
| 29 | Push notification delivery to devices | M | APNs/FCM, tokens, batching, rate limits |
| 30 | ★ Proximity search (Yelp / nearby places) | S | Geohash, quadtree, H3, read-heavy |
| 31 | ★ Ride-hailing (Uber/Lyft) | S | Location updates, matching, dispatch |
| 32 | Food delivery (DoorDash) | S | Three-sided marketplace, ETAs, order state |
| 33 | Hotel / Airbnb booking | S | Availability, double booking, holds |
| 34 | Ticketmaster (high-demand ticket sale) | S | Seat holds, queues, fairness, contention |
| 35 | Maps routing / ETA service | St | Graph partitioning, precomputation, traffic |
| 36 | ★ Payment system | S | Idempotency, ledgers, reconciliation, PSPs |
| 37 | Digital wallet | S | Double-entry ledger, transfers, consistency |
| 38 | E-commerce checkout and inventory | S | Reservations, sagas, oversell prevention |
| 39 | Flash sale | S | Pre-allocated stock, queues, Redis atomic ops |
| 40 | Stock exchange / order matching | St | Order book, sequencer, low latency |
| 41 | Online auction (eBay) | S | Bidding concurrency, end-time races |
| 42 | ★ Typeahead / search autocomplete | M | Trie, top-k per prefix, caching |
| 43 | ★ Web crawler | S | Frontier, politeness, dedup, scale-out |
| 44 | Search engine for a large site | S | Inverted index, ranking, index updates |
| 45 | ★ Top-K / trending (heavy hitters) | S | Count-Min Sketch, windows, stream processing |
| 46 | Ad click aggregation | S | Stream processing, exactly-once, reconciliation |
| 47 | ★ LLM chat service (ChatGPT-style) | S | GPU serving, streaming tokens, batching, quotas |
| 48 | RAG / semantic search over documents | S | Chunking, embeddings, vector index, freshness |
| 49 | Recommendation system | St | Candidate generation, ranking, feature store |
| 50 | Code execution / online judge (LeetCode) | S | Sandboxing, queues, resource limits |
Part 1: Core infrastructure (1-12)
1. Design a URL shortener (like bit.ly)
Clarify: custom aliases? expiry? analytics (click counts, referrers)? Read-heavy: redirects vastly outnumber creations.
Estimate: 100M new links/month is about 40 writes/s; at 100:1 read:write, about 4,000 redirects/s average. Five years x 1.2B links/year x ~500 bytes is about 3 TB.
API: POST /links {long_url, custom_alias?, expires_at?} returns short_code; GET /{code} returns 301/302.
Data model: links(code PK, long_url, owner_id, created_at, expires_at). A KV store or a sharded relational table keyed by code both work.
High-level design: clients -> load balancer -> stateless app servers -> cache (code -> URL) -> database. An async click-event stream feeds analytics.
Deep dives:
- Generating codes: (a) base62 of a unique counter (7 chars gives 62^7, about 3.5 trillion codes); hand out counter ranges to each server so they don’t coordinate per request; (b) hash the URL and take a prefix, then handle collisions; (c) pre-generated key pool. Counters are predictable; mention that if guessability matters, add a random component.
- 301 vs 302: 301 is cached by browsers (less load, worse analytics); 302 means every click hits you.
- Hot links: cache plus CDN for viral codes.
Trade-offs to mention: counter ranges vs hashing, analytics accuracy vs redirect latency (log asynchronously).
2. Design a rate limiter
Clarify: per user, per IP or per API key? Client-side or server-side? Hard or soft limits? Distributed across many gateway nodes?
Algorithms:
| Algorithm | How it works | Pros | Cons |
|---|---|---|---|
| Token bucket | Tokens refill at rate r; each request takes one | Allows bursts up to bucket size, cheap | Two parameters to tune |
| Leaky bucket | Queue drains at fixed rate | Smooth output | Bursts get queued or dropped |
| Fixed window counter | Count per minute | Simplest | 2x burst at window edges |
| Sliding window log | Store each timestamp | Exact | Memory-heavy |
| Sliding window counter | Weighted mix of current and previous window | Good accuracy, cheap | Approximate |
High-level design: rate limiting middleware in the API gateway; counters in Redis keyed by (client, window); use an atomic Lua script or INCR + EXPIRE so check-and-increment is one step. Return 429 Too Many Requests with Retry-After and rate limit headers.
Deep dives: race conditions (atomic scripts), multi-region (local limits with periodic sync vs global store), failing open vs closed when Redis is down, rules config service.
Real-world reading: Cloudflare: counting things, a lot of different things, NGINX rate limiting, Token bucket.
3. Design a distributed key-value store
Clarify: value size, consistency needs (tunable?), availability target, read/write ratio, multi-datacenter?
Core design (Dynamo-style):
- Partitioning: consistent hashing with virtual nodes.
- Replication: each key stored on N nodes (often 3) walking the ring.
- Quorums: write to W, read from R; R + W > N gives read-your-latest-write in the normal case.
- Conflicts: last-write-wins (simple, can lose data) vs vector clocks with client-side merge.
- Failure handling: hinted handoff for temporary failures, Merkle trees for anti-entropy repair, gossip for membership.
- Storage engine: LSM tree (memtable + write-ahead log + SSTables + compaction) for write-heavy loads; B-tree for read-heavy.
Deep dives: CAP trade-off in practice (choose availability vs consistency per operation), compaction strategies, tombstones and deletes.
Real-world reading: Amazon Dynamo paper, Bigtable paper.
4. Design a distributed cache
Clarify: cache-aside vs read-through? Data size, TTLs, consistency with the database?
Design: a cluster of cache nodes with consistent hashing; clients use a smart client or a proxy layer; LRU or LFU eviction; replication for hot shards.
Deep dives:
- Write strategies: cache-aside (app fills on miss), write-through (write cache + DB together), write-back (DB updated later; risk of loss).
- Stampede (thundering herd): request coalescing, a lock per key, early probabilistic refresh, serving stale while refreshing.
- Hot keys: replicate the key to several nodes, add a small in-process cache in front.
- Invalidation: delete on write, versioned keys, change-data-capture to invalidate.
Real-world reading: Scaling Memcache at Facebook.
5. Design a unique ID generator
Clarify: must IDs be sortable by time? 64-bit? How many per second? Multiple datacenters?
Options:
| Option | Notes |
|---|---|
| Database auto-increment | Simple; single point of failure and bottleneck |
| UUIDv4 | No coordination; 128-bit, random, poor index locality |
| UUIDv7 | Time-ordered 128-bit UUID; good index locality |
| Snowflake-style 64-bit | timestamp + machine ID + per-millisecond sequence; sortable, compact |
| Range allocation | A central service hands out blocks of IDs |
Deep dives: clock going backwards (refuse or wait), assigning machine IDs (config or a coordination service), sequence overflow within one millisecond (wait for the next tick).
Real-world reading: Twitter’s original Snowflake.
6. Design a message queue (like Kafka)
Clarify: ordering guarantees? retention? delivery semantics? throughput?
Design: topics split into partitions; each partition is an append-only log on a leader broker with follower replicas; producers choose a partition (by key for ordering); consumers in a group split partitions and commit offsets.
Deep dives:
- Delivery semantics: at-most-once (commit before processing), at-least-once (commit after; consumers must be idempotent), exactly-once (idempotent producers + transactions, within limits).
- Durability: replication factor, in-sync replicas,
acks=all. - Ordering: only within a partition; choose keys carefully.
- Backpressure: consumer lag monitoring, scaling consumers up to the partition count.
Real-world reading: Kafka documentation (design section).
7. Design a distributed job scheduler (cron at scale)
Clarify: one-off and recurring jobs? precision needed (seconds or minutes)? job duration? exactly-once expectations?
Design: job definitions in a database; a scheduler service scans for due jobs (index on next_run_at) and pushes them to a queue; workers lease jobs, run them, heartbeat, and mark completion; failed jobs retry with backoff, then go to a dead-letter queue.
Deep dives: avoiding double execution (leases with expiry, SELECT ... FOR UPDATE SKIP LOCKED, or a leader-elected scheduler), idempotent jobs (the honest answer: duplicates can happen, so make jobs safe to repeat), partitioning the scan by time buckets, priority queues.
8. Design a notification service
Clarify: channels (push, email, SMS, in-app)? transactional vs marketing? user preferences and quiet hours? volume?
Design: producers call POST /notify or publish events -> notification service validates, checks preferences and rate limits, renders templates -> per-channel queues -> channel workers call providers (APNs, FCM, email provider, SMS gateway) -> status tracking.
Deep dives: retries and dead-letter queues, dedup with idempotency keys, priority lanes (OTP codes before marketing), per-user frequency caps, provider failover.
9. Design an API gateway
Responsibilities: routing, authentication, rate limiting, request/response transformation, TLS termination, observability, canary routing.
Design: stateless gateway fleet behind a load balancer; config pushed from a control plane; plugins for auth and limits; per-route timeouts and circuit breakers.
Deep dives: keeping it thin (no business logic), config rollout safety, avoiding the gateway becoming a single point of failure, async non-blocking IO for many concurrent connections.
Real-world reading: Google SRE book: handling overload.
10. Design a distributed lock service
Clarify: what is the lock protecting? efficiency (occasional double work is fine) or correctness (must never overlap)?
Design: a consensus-backed store (ZooKeeper, etcd) with leases; clients acquire, renew via heartbeats, and release; locks expire if the client dies.
Deep dives: fencing tokens (monotonic numbers checked by the protected resource, so a paused client with an expired lease cannot corrupt data), why a single Redis instance with TTL is fine for efficiency but debated for correctness, session timeouts vs GC pauses.
Real-world reading: Martin Kleppmann: How to do distributed locking, Redis distributed locks, ZooKeeper recipes.
11. Design a metrics and monitoring system
Clarify: push or pull collection? cardinality (number of unique label combinations)? retention? alerting latency?
Design: agents or scrapers collect samples -> ingestion tier -> time series database (compressed chunks per series) -> query service -> dashboards and an alert evaluator -> notification routing.
Deep dives: compression (delta-of-delta timestamps, XOR floats), downsampling for long retention, high-cardinality labels as the main cost driver, alert deduplication and grouping, monitoring the monitoring system.
Real-world reading: Gorilla: Facebook’s in-memory time series database (VLDB paper).
12. Design a centralized logging system
Design: log shippers on each host -> buffer (Kafka) -> processors (parse, enrich, redact PII) -> hot store with full-text index for recent days -> cheap object storage for archives -> query UI.
Deep dives: sampling and rate limiting noisy services, schema (structured JSON logs), retention tiers and cost, backpressure when the indexer falls behind, PII redaction before storage.
Part 2: Social, content and media (13-22)
13. Design a news feed (Facebook / X home timeline)
Clarify: chronological or ranked? follower graph size? media? how fresh must posts appear?
Estimate: 300M daily users x 10 feed loads/day is about 35,000 feed reads/s average; writes are far fewer.
Design: post service writes posts; fan-out service pushes post IDs into followers’ precomputed timelines (in Redis lists or a wide-column store); feed service reads the timeline, hydrates posts and authors from caches, and ranks.
Deep dives:
- Fan-out on write vs read: push is fast to read but expensive for accounts with millions of followers; pull is cheap to write but slow to read. Hybrid: push for normal users, pull and merge for celebrities at read time.
- Ranking: candidate set -> lightweight model -> heavier model.
- Pagination: cursor-based using post IDs or timestamps, never offsets.
Real-world reading: Timelines at Scale (Twitter, InfoQ talk).
14. Design Instagram
Core features: upload photos, follow, feed, likes and comments.
Design: upload service gets a pre-signed URL so clients upload directly to object storage; an async pipeline creates resized variants and thumbnails; metadata in a sharded database; images served via CDN; feed as in question 13.
Deep dives: sharding by user ID, ID generation that embeds the shard, CDN cache keys and invalidation, storage cost (multiple sizes per image).
Real-world reading: TAO: Facebook’s distributed data store for the social graph.
15. Design YouTube (video upload and streaming)
Clarify: upload and watch only, or comments, recommendations, live? global audience?
Design: resumable chunked uploads to object storage -> transcoding pipeline (split into segments, encode several resolutions and codecs in parallel workers, orchestrated as a DAG) -> packaged for adaptive bitrate streaming (HLS/DASH) -> CDN; metadata DB; view counts via async events.
Deep dives: adaptive bitrate (player switches quality per segment), cost of transcoding (only encode rare formats on demand), popular vs long-tail content placement, resumable upload protocol.
16. Design Netflix
Extends question 15 with a fixed catalog and very predictable demand.
Design: content encoded once per title at many bitrates; files pre-positioned on edge caches inside ISP networks during off-peak hours; control plane (auth, catalog, personalization, playback licensing) runs in the cloud; data plane (bytes) comes from the edge.
Deep dives: predictive pre-positioning, steering clients to the best edge server, graceful degradation when personalization fails (show a default row), chaos testing.
Real-world reading: Netflix Open Connect.
17. Design Spotify (music streaming)
Design: audio files encoded at a few bitrates in object storage plus CDN; catalog and search service; playlist service (playlists are ordered lists with collaborative edits); play events stream for royalties and recommendations; offline downloads encrypted on device.
Deep dives: gapless playback via prefetching the next track, play counting accuracy (royalties depend on it), collaborative playlist conflicts.
18. Design Pastebin
Design: like a URL shortener, but the payload is text. Store content in object storage (or the DB for small pastes), metadata in a KV store, short ID as key; cache popular pastes; TTL-based expiry with a background cleaner.
Deep dives: size limits, abuse (spam, malware), syntax highlighting done on the client, read-heavy caching.
19. Design Google Drive / Dropbox
Clarify: sync across devices? sharing? version history? max file size?
Design: files split into chunks (for example a few MB each), each identified by its content hash; chunks stored in object storage; a metadata service maps files to ordered chunk lists and versions; a notification service (long polling or WebSockets) tells other devices to sync.
Deep dives: deduplication by content hash, only uploading changed chunks, conflict handling (keep both copies as “conflicted copy”), strongly consistent metadata store, upload resumption.
Real-world reading: Inside the Magic Pocket (Dropbox).
20. Design Google Docs (collaborative editing)
Clarify: number of concurrent editors per document? offline editing? comments and suggestions?
Design: clients send operations over WebSockets to a document session server (one owner per document at a time); the server orders and transforms operations and broadcasts them; operations appended to a log; periodic snapshots for fast loading.
Deep dives:
- OT vs CRDT: operational transformation needs a central server to order ops; CRDTs merge without a central order and suit offline/peer-to-peer, at the cost of metadata overhead.
- Presence and cursors: ephemeral, not persisted.
- Routing a document to one server: consistent hashing on document ID.
Real-world reading: How Figma’s multiplayer technology works, Operational transformation, crdt.tech.
21. Design a comment system with nested replies
Data model options: adjacency list (parent_id), materialized path (/1/7/23/), closure table. Materialized path makes “load a subtree in order” one indexed range scan.
Design: comments sharded by post ID; top-level comments paginated; replies loaded lazily; counts kept as denormalized counters updated asynchronously.
Deep dives: sorting by “top” (score with time decay), moderation queue, hot threads on viral posts (cache the first page).
22. Design a like or view counter at scale
Clarify: must the count be exact and immediate? Usually no: “1.2M views” is fine slightly stale.
Design: events go to a stream; aggregators batch increments per item per few seconds and write to the store; for hot items, split one logical counter into N sharded counters and sum on read; cache the displayed number.
Deep dives: dedup of repeated views (approximate with HyperLogLog for unique viewers), exactly-once vs at-least-once trade-offs, bot filtering before counts become “official”.
Part 3: Messaging and real-time (23-29)
23. Design a chat app (WhatsApp / Messenger)
Clarify: 1:1 and groups? delivery and read receipts? media? end-to-end encryption? multi-device?
Design: clients hold a persistent WebSocket to a chat gateway; a session registry maps user -> gateway server; message service persists to a store partitioned by conversation ID (ordered by a per-conversation sequence number), then routes to the recipient’s gateway or, if offline, stores for later and triggers a push notification.
Deep dives: ordering per conversation, at-least-once delivery with client-side dedup by message ID, sync on reconnect (“give me everything after sequence N”), receipts as small messages, group fan-out limits, end-to-end encryption means the server stores ciphertext only.
Real-world reading: How Discord stores trillions of messages, How Discord scaled Elixir to 5,000,000 concurrent users.
24. Design Slack (group chat)
Extends question 23 with channels, workspaces and search.
Design: channel membership service; message service writes to the channel log; fan-out to connected members via gateways; unread counts per user per channel; search index per workspace.
Deep dives: large channels (fan-out to tens of thousands), edge caching of workspace metadata for fast client boot, unread badge consistency, tenant isolation.
Real-world reading: Real-time messaging at Slack, Flannel: Slack’s application-level edge cache.
25. Design live comments for a live stream
Clarify: millions of viewers per stream? must every viewer see every comment? (No: nobody can read 5,000 comments/s.)
Design: comment write service -> pub/sub topic per stream -> tier of fan-out servers each holding many viewer connections (WebSocket or server-sent events); each fan-out server subscribes once per stream and broadcasts locally.
Deep dives: sampling or rate-limiting what each viewer sees, moderation before broadcast, hierarchical fan-out, reconnect storms when a popular stream starts.
26. Design a presence service (online/offline)
Design: clients heartbeat every N seconds; presence store keeps user -> last_seen with TTL; status changes published only to interested subscribers (friends currently online, open chat windows).
Deep dives: avoiding flapping (grace period before “offline”), cost of fan-out for users with huge contact lists (pull on demand instead), multi-device presence.
27. Design video conferencing (Zoom / Google Meet)
Clarify: meeting size? recording? global participants?
Design: signaling service (join, negotiate via WebRTC SDP) -> media servers. Options: mesh (each peer sends to every peer; only works for tiny calls), SFU (selective forwarding unit: each client uploads once, server forwards streams; most common), MCU (server mixes into one stream; CPU-heavy). Clients send multiple quality layers (simulcast) so the SFU forwards what each receiver can handle. TURN servers relay when peer-to-peer connectivity fails.
Deep dives: choosing the nearest media region, cascading SFUs across regions, bandwidth estimation, recording as a hidden participant.
Real-world reading: WebRTC, How Discord handles millions of concurrent voice users using WebRTC.
28. Design a collaborative whiteboard (Miro / FigJam-style)
Design: like question 20, but the document is a set of objects with properties. Last-writer-wins per property is often enough (two people rarely edit the same property of the same shape at once), with server ordering. Periodic snapshots plus an op log; large boards load visible region first.
Deep dives: spatial indexing for viewport queries, undo per user, offline merge.
29. Design push notification delivery to mobile devices
Design: device registry stores push tokens per user per device; send service batches requests to Apple Push Notification service and Firebase Cloud Messaging; handles token invalidation responses; per-app and per-user rate limits.
Deep dives: bursts (a breaking-news alert to 50M devices), priority, collapse keys so only the latest notification shows, tracking delivery vs open.
Real-world reading: Apple User Notifications docs, Firebase Cloud Messaging docs.
Part 4: Location and marketplaces (30-35)
30. Design proximity search (Yelp / “places near me”)
Clarify: static places (restaurants) or moving objects (drivers)? radius queries? ranking?
Design: places in a database; a spatial index answers “places within r km of (lat, lng)”; results ranked by distance, rating and relevance; heavy caching since places rarely move.
Index options:
| Index | Idea | Notes |
|---|---|---|
| Geohash | Encode lat/lng into a string; nearby points share prefixes | Easy with any KV/SQL index; check neighboring cells at edges |
| Quadtree | Recursively split dense areas into 4 | Adapts to density; in-memory |
| Hexagonal grid (H3) | Fixed hierarchical hexagons | Uniform neighbor distances |
| S2 cells | Hierarchical cells on a sphere | Used by many map systems |
| PostGIS / R-tree | Database spatial index | Great until very high scale |
Real-world reading: Uber H3, H3 docs, S2 Geometry, Geohash.
31. Design Uber / Lyft (ride-hailing)
Clarify: matching only, or pricing, payments, ETAs? scale of drivers sending location?
Estimate: 1M active drivers sending location every 4 s is 250,000 writes/s, so location updates are the hot path.
Design: driver apps stream locations to a location service that keeps the latest position in memory (indexed by geo cell) rather than a durable DB per update; rider requests go to a matching/dispatch service that queries nearby available drivers, ranks by ETA, and offers the trip to one driver at a time with a timeout; trip service manages the trip state machine; payments after completion.
Deep dives: partitioning by city/region, avoiding double assignment of a driver (atomic state change), surge pricing as supply/demand per cell, handling a driver going offline mid-offer.
32. Design a food delivery platform (DoorDash / Uber Eats)
Design: three parties (customer, restaurant, courier). Order service with a clear state machine (placed, accepted, preparing, picked up, delivered); menu service with caching; dispatch batches couriers to orders using predicted prep time and travel time; notifications to all three parties.
Deep dives: ETA prediction, idempotent state transitions, restaurant tablets going offline, peak-hour load (lunch, dinner).
33. Design a hotel / Airbnb booking system
Clarify: inventory per room type or per listing? holds during checkout? cancellations?
Design: search service (read replicas, search index, caching) is separate from the booking service (strongly consistent DB). Booking uses a temporary hold with expiry, then confirmation after payment.
Deep dives: preventing double booking: a unique constraint on (listing_id, date) rows, or optimistic locking with a version column, or SELECT ... FOR UPDATE; idempotency keys on “book” requests; cache staleness in search vs truth at booking time.
34. Design Ticketmaster (selling tickets for a huge on-sale)
Clarify: assigned seats or general admission? how many fans at the on-sale moment vs seats available?
Design: a virtual waiting room admits users in batches; seat map served from cache; seat selection creates a short hold (for example a Redis key with TTL or a row with held_until); payment confirms the hold; expired holds return seats.
Deep dives: contention on popular seats (fail fast, suggest alternatives), fairness and bot defense in the queue, protecting the core booking DB from the stampede, idempotent payment.
35. Design a maps routing / ETA service
Design: road network as a graph partitioned into regions; shortest paths with precomputation techniques (for example contraction hierarchies) so queries avoid exploring the whole graph; live traffic adjusts edge weights; ETA model blends historical and live speeds.
Deep dives: updating weights frequently without full recomputation, map tiles served via CDN, rerouting at scale.
Part 5: Commerce and money (36-41)
36. Design a payment system
Clarify: are we a merchant integrating a payment provider, or the provider? currencies? refunds? payouts?
Design: payment service receives a checkout request with an idempotency key, records a payment intent, calls the external payment service provider, records the result, and writes double-entry ledger entries; webhooks from the provider update status; a reconciliation job compares our ledger with provider settlement files daily.
Deep dives: idempotency everywhere (retries are normal in payments), never losing a state (state machine plus outbox pattern), handling “unknown” outcomes after timeouts (query the provider before retrying), PCI scope (never store raw card data; use tokens), exactly-once is achieved by idempotency + reconciliation, not by magic.
Real-world reading: Stripe: designing robust and predictable APIs with idempotency, Transactional outbox pattern.
37. Design a digital wallet (peer-to-peer transfers)
Design: accounts and an append-only double-entry ledger (every transfer writes a debit and a matching credit; balances are derived or cached); transfers inside one database transaction when both accounts are on the same shard; across shards, a saga or two-phase approach with a pending state.
Deep dives: preventing negative balances under concurrency (row locks or conditional updates), audit trail, event sourcing to rebuild balances, reconciliation.
Real-world reading: Saga pattern, Two-phase commit.
38. Design e-commerce checkout and inventory
Design: cart service (fast KV), checkout orchestrator, inventory service, payment service, order service. Checkout runs as a saga: reserve inventory -> authorize payment -> create order -> confirm; compensating actions release inventory if payment fails.
Deep dives: reserve vs decrement (reservations with expiry), oversell tolerance by business, consistency between the search page’s “in stock” and reality, idempotent order creation.
39. Design a flash sale system
Clarify: 10,000 items, 5 million people at 12:00:00. Most requests must fail fast and cheaply.
Design: static pages on CDN; a gate (rate limiting, queue, captcha/bot checks) in front; stock counter in Redis decremented atomically (DECR or a Lua script) so only N requests succeed; winners get a token to proceed to an async order pipeline via a queue; DB writes happen at a controlled pace.
Deep dives: preventing overselling (atomic decrement, then a DB unique constraint as a safety net), handling unpaid orders (return stock after timeout), hot key on the single counter (split stock across several keys).
40. Design a stock exchange (order matching)
Clarify: latency targets (microseconds), fairness, number of symbols.
Design: gateway -> risk checks -> sequencer assigns a global order to all incoming orders -> single-threaded matching engine per symbol keeps the order book in memory (price-time priority) -> emits executions to market data and clearing; everything is journaled so the engine can be rebuilt by replaying the input log.
Deep dives: why single-threaded deterministic matching (no locks, replayable), hot-standby replicas fed the same log, market data fan-out via multicast.
41. Design an online auction (eBay)
Design: auction service stores item, current high bid, end time; bids validated with a conditional update (UPDATE ... SET high_bid = :bid WHERE id = :id AND high_bid < :bid AND ends_at > now()); bid history appended; watchers notified via pub/sub.
Deep dives: last-second bid races (server clock is the authority), automatic proxy bidding, closing auctions reliably at scale (scheduled job, question 7).
Part 6: Data, search and analytics (42-46)
42. Design typeahead / search autocomplete
Clarify: suggestions from query logs or a catalog? personalization? latency budget (well under 100 ms)?
Design: offline pipeline aggregates query frequencies (daily or hourly) -> builds a trie or prefix table storing top-k completions per prefix -> loaded into in-memory serving nodes, sharded by prefix -> clients debounce keystrokes and cache results.
Deep dives: precomputing top-k at each node vs computing at query time, freshness for trending queries (merge a small real-time layer), filtering offensive suggestions, prefix-based sharding hot spots (“a”, “s”).
43. Design a web crawler
Clarify: how many pages? (billions) freshness? which content types?
Design: seed URLs -> URL frontier (prioritized queues, plus per-host queues for politeness) -> fetchers (respect robots.txt, rate per host) -> DNS cache -> content parser -> dedup (content fingerprint) -> store page -> extract links -> URL filter + “seen” check (Bloom filter or a large KV set) -> back to the frontier.
Deep dives: politeness, crawler traps (infinite calendars), near-duplicate detection (SimHash-style fingerprints), recrawl scheduling by change rate, distributing by host hash so one worker handles one host.
44. Design search for a large site (product or post search)
Design: source DB -> change-data-capture stream -> indexing workers -> inverted index (Elasticsearch/OpenSearch, sharded); query service parses, retrieves candidates, ranks (BM25 plus business signals plus optionally a learned or semantic re-ranker), returns facets.
Deep dives: index lag vs freshness, reindexing with zero downtime (alias swap), relevance tuning and offline evaluation, typo tolerance.
45. Design top-K / trending topics (heavy hitters)
Clarify: top-K over what window (last hour, last day)? exact or approximate?
Design: events -> stream processor that keeps per-window counts. For huge key spaces, use a Count-Min Sketch plus a min-heap of the current top K per partition, then merge partial top-Ks. An exact batch job (for example hourly) corrects the approximate real-time view.
Deep dives: sliding vs tumbling windows, merging partial results correctly (approximate per-partition top-K can miss keys spread evenly across partitions), “trending” = rate of change, not raw count.
46. Design ad click aggregation
Clarify: latency of reports (minutes)? billing-grade accuracy?
Design: click events -> Kafka -> stream aggregation by (ad_id, minute) -> OLAP store for queries; raw events kept in object storage; a daily batch job recomputes from raw data and reconciles with the streaming results.
Deep dives: dedup of duplicate clicks (event IDs), late-arriving events and watermarks, exactly-once processing within the pipeline, fraud filtering, hot ads.
Part 7: AI-era systems (47-50)
These come up more often in 2025-2026 loops, especially at AI-heavy companies.
47. Design an LLM chat service (ChatGPT-style)
Clarify: host our own models or call a provider? context length? streaming? free vs paid tiers?
Design: client -> API gateway (auth, per-user token quotas) -> conversation service (stores messages) -> inference router -> GPU serving fleet. Responses streamed token by token over server-sent events or WebSockets. Conversation history trimmed or summarized to fit the context window.
Deep dives:
- Throughput: continuous batching (new requests join a running batch between decoding steps) and paged KV-cache memory management raise GPU utilization a lot.
- Latency metrics: time to first token vs tokens per second.
- Capacity: GPUs are the scarce, expensive resource; queue with priorities per tier; route to smaller models when overloaded.
- Caching: prompt/prefix caching for shared system prompts.
- Safety: input and output moderation; rate limiting abuse.
Real-world reading: vLLM, PagedAttention paper, Anyscale: continuous batching.
48. Design RAG / semantic search over company documents
Design: ingestion (connectors -> parse -> chunk -> embed -> store vectors with metadata and permissions) and query (embed question -> hybrid retrieval: vector + keyword -> re-rank -> build prompt -> LLM -> answer with citations).
Deep dives: chunk size and overlap, access control filtering at retrieval time (never leak documents a user can’t see), freshness via incremental re-embedding, approximate nearest neighbor indexes (HNSW), evaluation sets for retrieval quality.
Real-world reading: HNSW paper, FAISS.
49. Design a recommendation system
Design: two stages: candidate generation (cheap: collaborative filtering, embeddings nearest neighbors, popular items, follows) narrows millions of items to hundreds; ranking (a heavier model using user, item and context features) orders them; a re-ranking step adds diversity and business rules. A feature store serves the same features online and offline; training pipelines run on logged impressions and outcomes.
Deep dives: cold start (new users and items), feedback loops and popularity bias, online vs offline metrics, A/B testing.
50. Design an online judge / code execution service (LeetCode-style)
Design: submission API -> queue -> sandboxed runners (containers or microVMs with CPU, memory, time and network limits) -> compare output against test cases -> store verdict -> push result to the client.
Deep dives: sandbox security (no network, read-only filesystem, seccomp, separate kernels via microVMs for untrusted code), contest-time spikes (autoscale runners, priority for contests), fairness of timing measurements, caching compiled artifacts.
What interviewers expect by level
| Level | Typical expectation |
|---|---|
| Mid-level (L4 / E4 / SDE II) | A working end-to-end design, sensible storage choice, basic scaling (caching, replication), responds well to hints |
| Senior (L5 / E5 / SDE III) | Drives the conversation, quantifies, identifies the real bottleneck, two or three solid deep dives with trade-offs, failure handling |
| Staff+ (L6+ / E6+) | Questions the requirements, considers operations, cost, migration and organizational impact, spots second-order effects, multiple valid designs compared |
Level names differ by company; titles above are examples, not an official mapping.
Common mistakes
- Jumping to boxes before agreeing on requirements.
- Using every technology you know (“Kafka, Redis, Cassandra, Kubernetes…”) without saying why.
- Never doing numbers, or doing numbers that change nothing.
- Ignoring failure: what happens when this service, cache or region is down?
- Designing a perfect system for one feature and leaving the main flow unfinished.
- Saying “exactly-once” or “strongly consistent” without explaining how.
- Not listening to hints; the interviewer often steers you to the part they want to grade.
4-week study plan
| Week | Focus | Questions | Reading |
|---|---|---|---|
| 1 | Building blocks + framework | 1, 2, 5, 18, 42 | System Design Primer, latency numbers |
| 2 | Storage and scale | 3, 4, 6, 13, 19 | Dynamo and Memcache papers |
| 3 | Real-time, location, money | 23, 30, 31, 34, 36 | Discord and Stripe posts above |
| 4 | Mixed mocks + your domain | 15, 20, 45, 47 + 3 random | Mock with a partner twice |
Each day: one question solo (45 min), compare with the outline, then read one real write-up. Twice a week, do a mock with a person.
Best resources
Free
| Resource | What it is | Best for |
|---|---|---|
| The System Design Primer | Huge open-source GitHub guide | Foundations and classic questions |
| Hello Interview: System Design in a Hurry | Free written guide plus problem breakdowns (list); some content is paid | Modern interview-style answers |
| AWS Builders’ Library | Articles by Amazon engineers | Real operational trade-offs |
| Google SRE books | Free online books | Reliability, overload, load balancing |
| Patterns of Distributed Systems (Martin Fowler site) | Pattern catalog | Leases, quorums, logs, clocks |
| ByteByteGo blog and YouTube | Diagrams and short explainers; newsletter partly paid | Visual refreshers |
| Jordan has no life (YouTube) | Deep system design videos | Depth on databases and streaming |
| awesome-system-design-resources | Curated link list | Finding more reading |
| Jepsen | Analyses of database consistency claims | Understanding real consistency |
| Highscalability.com | Long-running architecture blog | Real-world case studies |
Paid (worth considering)
| Resource | Notes |
|---|---|
| Designing Data-Intensive Applications by Martin Kleppmann and Chris Riccomini (O’Reilly, 2nd edition 2026) | The best single book on the ideas underneath every system design answer. Paid. Book site, author post on the 2nd edition |
| System Design Interview: An Insider’s Guide, Volumes 1 and 2, by Alex Xu (and Sahn Lam for Vol. 2) | Interview-focused walkthroughs. Paid. Vol. 1 on Amazon, Vol. 2 on Amazon |
| ByteByteGo course | Online version of the Alex Xu material plus more. Paid subscription |
| Hello Interview premium / Exponent / interviewing.io | Paid mocks with experienced interviewers; Exponent also has free peer practice |
Papers worth reading once: GFS, MapReduce, Bigtable, Dynamo, Spanner, Borg, Raft.
FAQ
How do I prepare for a system design interview with no distributed systems experience? Learn the building blocks table above first, then practice the five starred infrastructure questions until you can explain caching, replication, sharding and queues without notes. Interviewers for mid-level roles mostly test whether you can build a reasonable design and react to hints.
How many system design questions should I practice? Quality over count. Fifteen to twenty questions done properly (timed, out loud, compared, with one deep dive each) cover nearly every pattern. The same ideas repeat: fan-out, sharding, caching, idempotency, queues, geo-indexing.
Do I need to know specific technologies like Kafka or Cassandra? Know what each category does and its trade-offs. Naming a real tool is fine, but be ready to explain why it fits. “A log-based message broker like Kafka, because we need replay and ordered partitions” beats “Kafka” alone.
Should I draw a database schema? Briefly. List the main entities, their keys and the access patterns. Spend more time on how the data is partitioned and queried than on every column.
What if the interviewer asks about something I don’t know? Say so, then reason from first principles: “I haven’t used X, but I’d expect the constraint to be Y, so I’d approach it by Z.” Bluffing is worse than admitting a gap.
Is SQL or NoSQL the right answer? Neither by default. Relational databases are a great default for transactional data with relationships; wide-column or KV stores fit very high write volumes with simple, known access patterns. Explain the choice from the access pattern.
How is system design different for frontend or mobile roles? Expect client architecture: state management, caching on device, offline sync, pagination, API design from the client side, performance budgets. Many of the API and sync ideas here still apply.
Can I use AI tools in system design interviews? Only if the company explicitly allows it. Some companies have started piloting AI-assisted rounds; most system design rounds still expect you to reason unaided. Ask your recruiter.
Where to go next
- Practice coding rounds too: see a FAANG interview prep plan.
- Brush up on SQL for backend and data rounds: SQL interview questions.
- Read the System Design Primer end to end once.
- Read one chapter of Designing Data-Intensive Applications per week, even after your interview.
- Pick three companies you admire and read their engineering blogs (Discord, Slack, Meta, LinkedIn).
Contributing
Found a mistake, a dead link, or have a better deep dive for one of the 50 questions? Open an issue or a pull request. Please:
- Keep outlines original and concise (no copying from paid books or courses).
- Link only to free, public sources, and check that links work.
- Add new questions only if they teach an idea the list does not already cover.
If this helped you, a star helps others find it.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.