Notes
All notes

System design interview question bank: 33 problems with companies

Problem. The system design list is finite — Google, Meta, Amazon, Netflix, Uber, and Stripe all draw from the same ~30 classics, plus a new 2026 layer of AI-lab questions. This bank lists them with the companies that actually ask each one, and what a good answer contains. Format per question follows the round rubric: clarify, estimate, API, core design, deep dives.

Open every design the same way: requirements (functional + non-functional), back-of-envelope math, API sketch, happy-path boxes, then spend the bulk on 2–3 deep dives (the bottleneck, not everything). Interviewers score choices with trade-offs stated, not components named.

Short on time? Each question below is summarized here; full walkthroughs with estimation math and APIs live in six parts: foundations · feeds · geo & marketplaces · media & storage · money · AI era.

Foundations

1. Design a URL shortener [Google, Amazon, Microsoft, Uber]

Counter + base62 codes (collision-free, short), cache-aside reads (10:1 read:write), sharded store by code hash, 302 redirects (keeps analytics and retargeting; 301 caches forever).

Deep dives. Custom aliases (unique constraint, first-writer-wins), rate limiting shorten calls, malicious-URL scanning, expiry without breaking cached redirects. Covered in depth in part 5 of the system design course.

2. Design a rate limiter [Stripe, Cloudflare, Google, Amazon]

Token bucket per client in Redis (atomic Lua): capacity bounds bursts, refill rate bounds the average; 429 + Retry-After on empty.

Deep dives. Fixed window’s 2× boundary spike vs sliding-window counters, per-user vs per-endpoint vs global limits, gateway-level (Envoy) vs service-level enforcement, communicating limits to clients.

3. Design a web crawler [Google, Microsoft, Amazon, ByteDance]

Frontier queue of URLs, fetcher pool with per-domain politeness delays, robots.txt respect, dedup by content hash (SimHash for near-dupes), DNS/connection reuse.

Deep dives. BFS ordering vs PageRank-ordered crawl priority, recrawl scheduling by change rate, distributed dedup (bloom filter first, exact check second), handling traps (calendars, infinite facets).

4. Design a distributed key-value store [Amazon, Google, Redis Labs, MongoDB]

The Dynamo paper made interviewable: consistent hashing ring for placement, quorum reads/writes (\(W + R > N\)), vector clocks or last-write-wins for conflicts, hinted handoff + Merkle-tree anti-entropy for failures.

Deep dives. When to sacrifice availability for consistency (and say so), gossip membership, what breaks when a node flaps. This answer underlies half the bank — nail it once, reuse everywhere.

5. Design a distributed cache [Meta, Amazon, Google, Redis]

Memcache-style look-aside: client hashes key to a pool node, LRU within the node, TTLs with jitter, thundering-herd protection (request coalescing, hot-key replication).

Deep dives. Cache-aside vs read/write-through, invalidation vs short TTL on write-heavy keys, cold-start warming, and the “cache is a distributed system too” talking points: consistent hashing on membership change, rebalance storms.

6. Design a CDN [Cloudflare, Akamai, Fastly, AWS]

Edge PoPs serving static bytes near users; origin shield tiers; pull on miss with TTL; push invalidation on deploy (or versioned filenames instead).

Deep dives. Cache-hit ratio as the business metric, TLS termination at edge, dynamic-content acceleration (connection reuse, not caching), and what poisoning/stale-serve trade-offs you accept during outages.

7. Design a distributed message queue [LinkedIn, Confluent, Amazon, Google]

Append-only partitioned log (Kafka model): producers append, consumers track offsets, retention by time/size; ordering per partition only.

Deep dives. At-least-once + idempotent consumers as the default contract, consumer-group rebalancing pain, exactly-once via transactions (and its cost), backpressure (bounded queues, shed or page). Pairs with the async chapter of the system design course.

8. Design a task/delayed-job scheduler [Google, Amazon, OpenAI, Cursor, Decagon]

Due jobs in a time-ordered structure (timer wheel or sorted set), workers lease tasks with heartbeats, visibility timeouts redeliver on worker death, durable state before ack.

Deep dives. “Run at 3 AM, survive failures” semantics: at-least-once delivery plus idempotent jobs, delayed-queue implementation (Redis sorted sets are the classic answer), fair sharing across tenants (Decagon/Cursor angle), dependency-aware DAG scheduling for CI flavors.

9. Design a logging/metrics pipeline [Splunk, Elastic, Datadog]

Agents ship structured events to a buffered ingest (queue), stream processors aggregate (counters, histograms, percentiles — never averages alone), hot/warm/cold storage tiers by query recency.

Deep dives. Cardinality explosions in label sets, sampling tails vs heads, backpressure when sources spike, and separating the real-time alerting path from the batch analytics path.

Social and feeds

10. Design Twitter/X (feed) [Twitter, Meta, Google, Microsoft]

Fan-out-on-write for normal users (push to followers’ home caches), fan-out-on-read for celebrities (pull on request); the hybrid avoids both the write storm and the slow celebrity read.

flowchart LR
    U[Post tweet] --> API[API]
    API --> DB[(Tweet store)]
    API --> Q[Queue]
    Q --> F1[Fan-out worker]
    F1 --> C[Home caches]

Deep dives. The celebrity threshold number and how you’d measure it, ranking vs chronological (separate the fan-out from the ranker), media uploads on a different path, timeline pagination cursors.

11. Design Instagram [Meta, Snap, ByteDance, Pinterest, Microsoft, X]

Feed core as above, plus: object storage for media with CDN delivery, async image/video processing pipeline (thumbnails, compression), and the social graph (follow edges) as its own store.

Deep dives. Upload-then-process flows with progress, Stories’ TTL and read-fan-out, Explore ranking as a separate ML system, celebrity/media-page read patterns.

12. Design WhatsApp / Messenger chat [Meta, Signal, Snap, Microsoft, Uber, TikTok, Amazon, Google, LinkedIn]

WebSocket (or QUIC) connections pinned to stateful gateway servers; messages persisted then routed to the recipient’s gateway; offline queue + push notification fallback; end-to-end encryption as a stated assumption.

Deep dives. Connection registry (which gateway holds whom), exactly-once display with dedup ids, message ordering per conversation, media over a side channel, group fan-out (small groups fan-out-on-write, huge channels read-on-pull).

13. Design a notification service [Meta, Slack, Discord, Salesforce]

Single intake API, per-channel workers (push/email/SMS), per-user preference and rate-limit checks, priority lanes (OTP jumps the queue), dead-letter for provider failures.

Deep dives. Template rendering + localization, idempotency keys so retries don’t double-notify, provider failover, and digest batching (one email, not forty) as the cost lever.

14. Design TikTok / short video [TikTok, ByteDance]

Upload → transcode farm → object storage + CDN; the feed is a recommendation problem wearing a video player (candidate generation, then ranking); aggressive prefetch of the next videos.

Deep dives. Always mention popularity-tiered caching plus ML personalization (their engineering lore); live-streaming as a separate low-latency path; comment/like counters with sharded writes.

Geo and marketplaces

15. Design Uber / ride-hailing [Uber, Lyft, DoorDash, Ola]

Geo-sharded driver locations (geohash quadtree cells), dispatch matching in the rider’s cell + neighbors, trip state machine (requested → matched → ongoing → billed), separate payments path.

Deep dives. Location update frequency vs battery/load, surge as a supply-demand signal, ETAs from segment speeds, exactly-once billing. Uber’s engineering blog is the expected citation.

16. Design Airbnb / bookings [Airbnb, Booking, Expedia]

Search over listings (geo + filters + availability calendar), booking as a transactional hold-then-confirm with expiry, reviews as a separate write-heavy path, trust/safety async checks.

Deep dives. Calendar availability under concurrency (optimistic holds, not locks), search ranking vs filter pushes, double-booking prevention as the correctness core.

17. Design food delivery [Swiggy, DoorDash]

Three-sided marketplace (eater, restaurant, courier): order state machine, courier assignment (batching nearby orders), live tracking on websockets, prep-time estimates feeding dispatch.

Deep dives. Batching algorithm (when to bundle), hotspot load (dinner rush = flash sale), restaurant tablet as an unreliable client (offline tolerance).

18. Design e-commerce checkout [Amazon, Flipkart]

Cart → reserve inventory (TTL holds) → payment → confirm/cancel with compensating actions (saga, not 2PC across services); idempotency keys on every mutating call.

Deep dives. Flash-sale mode (queue + lottery vs first-come with oversell protection), inventory accuracy vs availability, the saga’s compensating transactions as the graded topic.

19. Design ticket booking like BookMyShow [Flipkart, MakeMyTrip-type; widely asked in India]

Seat map with optimistic locking: select seats → temporary hold with TTL → pay → confirm; holds visible to others immediately to prevent double-sell.

Deep dives. The hold TTL number and what happens on payment timeout, seat-map fan-out to thousands of concurrent viewers (read replicas + cache, writes serialized per show), waiting-list promotion.

Media and storage

20. Design YouTube / Netflix streaming [Netflix, YouTube, Amazon, Meta]

Upload → transcode ladder (240p–4K) → object storage → CDN; playback is adaptive bitrate (client picks segments by measured bandwidth); watch history and resume cursors as metadata.

Deep dives. Open Connect-style edge caches inside ISPs (Netflix lore), live vs VOD paths, DRM license flow, thumbnail/prefetch optimizations, and why upload and playback are different systems.

21. Design Dropbox / Drive file sync [Dropbox, Google, Microsoft, Box]

Chunk files (4MB blocks), content-hash dedup, delta sync (only changed chunks upload), metadata service separate from blob storage, LAN sync and conflict copies for edge cases.

Deep dives. The metadata/blob split is the whole answer; conflict resolution policy, sharing permission checks on every read, large-file resumable uploads.

22. Design search autocomplete / typeahead [Google, Microsoft, Amazon, LinkedIn]

Prefix trie (or FST) sharded by prefix, popularity-ranked completions, debounced keystroke queries, aggressive caching of top prefixes.

Deep dives. Personalization vs global popularity, typo tolerance (edit-distance index), freshness for trending queries, and the follow-up they love: “now make it full web search” (crawl → index → rank).

23. Design Google Docs real-time collaboration [Google, Microsoft, Notion, Figma]

Operation-based sync over websockets: Operational Transformation (Docs) or CRDTs (newer systems) for convergence; presence awareness as ephemeral state; snapshots + op log for history.

Deep dives. OT vs CRDT trade-off (central ordering vs peer merge — cite Figma’s multiplayer article), offline editing with sync conflicts, and comment threads as a separate model from document ops.

Money

24. Design Stripe-style payments [Stripe, PayPal, Square]

Tokenize cards (never touch PANs — PCI scope), idempotency keys on charges, ledger as append-only source of truth, webhook delivery with retries for async outcomes.

Deep dives. Double-charge prevention as the correctness core, currency conversion timing, dispute/chargeback flows, exactly-once settlement via reconciliation jobs. Stripe’s engineering blog is the expected citation.

25. Design Visa-style card processing [Databricks, reported Sep 2026]

Scope it first: card network between banks, or merchant-side service. Then: authorization path (synchronous, millisecond budget, standby replicas) vs clearing/settlement (batch, end of day).

Deep dives. The auth latency budget drives everything (in-memory decisions, precomputed risk scores); settlement as a separate batch pipeline; fraud scoring inline without blowing the budget.

26. Design a stock trading system [Robinhood, Jane Street, Citadel]

Market-data ingest (multicast feeds, sequence gaps), order matching engine (price-time priority, single-threaded per symbol for determinism), risk/pre-trade checks inline, drop-copy feeds for back office.

Deep dives. Determinism over throughput in the matcher, failover without double-fills (the graded topic), latency measurement in microseconds with kernel bypass named, not implemented.

AI-era questions (2026 layer)

27. Design an enterprise AI research agent [Cohere, reported Sep 2026]

Internal + web retrieval with synthesis and citations, respecting per-user permissions: permission-filtered retrieval (filter before generation, never after), source-attached citations, audit log of what it read.

Deep dives. The permission boundary is the graded topic (leakage via citations or cache poisoning across users), connector fan-out, and eval on groundedness over internal corpora.

28. Design a long-running query service [Perplexity, reported Sep 2026]

Durable async jobs: submit returns a job id, status/result polling (or webhooks), resource limits, explicit retry/cancel/failure semantics, surviving worker loss via leased execution + checkpoints.

Deep dives. Polling vs SSE vs webhooks for result delivery, exactly-once effects with idempotent steps, progress reporting, and cost attribution per tenant.

29. Design concurrent image processing with backpressure [Anthropic, reported Jul 2026]

One worker to many: lease-based task claiming (no double-processing), idempotent outputs (same input → same key), retries with backoff, cancellation propagation, bounded queues that push back instead of growing.

Deep dives. Leasing vs static partitioning, poison-task quarantines, cancellation as a first-class signal (not an afterthought), and metrics that distinguish slow from stuck.

30. Design an AI travel booking agent [OpenAI, Anthropic, Google]

Orchestrator plus tool gateway: flight/hotel tools behind one schema, credential vault (never in prompts), risk-classified actions (search freely, book only with confirmation), rollback/compensation for partial failures.

Deep dives. Confirmation UX for irreversible actions, idempotent bookings, multi-step failure recovery, and evaluation on task completion with seeded scenarios — not vibes.

31. Design an AI code assistant [Microsoft, Google, JetBrains]

Latency-sensitive completion: local context assembly (open files, imports, recent edits), small fast model for inline ghost text, bigger model for chat and refactors, caching by prefix, telemetry-gated rollouts.

Deep dives. The 100ms completion budget drives everything (context pruning, speculative requests, streaming); privacy (what leaves the IDE); eval on acceptance rate plus retained-code metrics, not just latency.

32. Design real-time fraud detection [Stripe, PayPal, Amazon]

50ms budget at tens of thousands TPS: precomputed features, in-memory rules first, model score second, async deep analysis after the decision.

Deep dives. Feature freshness (streaming vs batch features, training-serving skew), continuous model updates without downtime, and the precision/recall business trade (blocked good users cost more than most engineers think).

33. Design a feature store for ML [Netflix, Uber, Airbnb]

One definition of each feature for training and serving: batch backfill for history, streaming for freshness, point-in-time correctness (no leakage), versioned features with deprecation.

Deep dives. Training-serving skew as the graded topic, online store latency (Redis-like) vs offline warehouse, and backfill mechanics for new features.

Edge cases for interview day