System design

System design interview prep

60 questions worked through at staff-level depth: capacity math, tradeoff tables, and the non-obvious insights that separate a senior answer from a principal one.

questions
60
levels, mid to staff
3
categories
9
Topic
Level

Showing 60 of 60 questions

Design an A/B Testing Platform Design an experiment platform that assigns users to A/B test variants deterministically, collects and aggregates metric events, detects Sample Ratio Mismatch, and performs statistical significance tests with variance reduction. Senior AI Systems 22 min read Design a Real-Time Collaborative Editor Implement conflict-free concurrent editing with Operational Transformation or CRDTs, maintain causal consistency across all collaborators, persist document history, and fan-out changes in real-time to all active editors. Staff Real-time 28 min read Design a Content Moderation System Design a multi-layer content moderation pipeline combining pre-upload hash matching, real-time ML classifiers for text/image/video, async human review queues, and an appeals management system. Senior AI Systems 22 min read Design a Feature Store Build a dual-store feature platform with an offline Hive/Spark store for point-in-time correct training data and a Redis online store for low-latency serving, bridged by a Kafka materialization pipeline. Staff AI Systems 25 min read Design a Real-Time Fraud Detection System Build a layered fraud detection system combining synchronous rule engine for hard blocks, real-time ML scoring with velocity features, and an asynchronous graph-based fraud ring detection pipeline. Staff AI Systems 26 min read Design a Live Sports Score System Ingest score events from sports data feeds, fan-out updates to millions of concurrent WebSocket and SSE connections, and maintain a globally consistent live scoreboard with sub-second latency. Mid Real-time 18 min read Design an LLM Serving Infrastructure Design production LLM serving infrastructure handling auto-regressive token generation at scale, using continuous batching, PagedAttention KV cache management, speculative decoding, and multi-node tensor parallelism. Staff AI Systems 28 min read Design an ML Model Serving Infrastructure Design a production ML serving platform that handles model versioning, online and batch inference, adaptive micro-batching, shadow-mode deployment, and canary rollouts with automatic rollback. Staff AI Systems 26 min read Design a Multiplayer Game Backend Design an authoritative game server with deterministic tick-based simulation, client-side prediction, lag compensation via history buffers, and a matchmaking service that pairs players by skill rating. Senior Real-time 24 min read Design an Online Auction System Model an auction as a state machine, prevent double-bidding and sniping, handle concurrent bids under high contention, and fan-out real-time bid updates to all watchers. Senior Commerce 22 min read Design a Recommendation Engine Architect a production recommendation system combining offline collaborative filtering, real-time feature pipelines, two-tower neural network retrieval, and a lightweight ranking layer — deployed at billions-of-events scale. Staff AI Systems 28 min read Design a Search Ranking System Design a production search ranking system with a two-stage pipeline: BM25 recall at scale followed by a neural re-ranker, trained on implicit click signals using Learning to Rank with NDCG loss. Staff AI Systems 26 min read Design a Stream Processing System Design a stream processing system using Kafka as the event backbone and Apache Flink for stateful computation with windowing, watermarks for late data, and exactly-once semantics via two-phase commit. Senior Infra 22 min read Design a Vector Database Build a distributed approximate nearest neighbor search system over dense embedding vectors using HNSW indexing, support CRUD operations with immediate consistency, and scale to billions of vectors with sub-10ms query latency. Staff AI Systems 26 min read Design Airbnb Design Airbnb's two-sided marketplace: geo-spatial listing search with availability filtering, calendar-based booking with double-booking prevention, dynamic pricing, and the data model that handles 7 million listings across 220 countries. Senior Commerce 23 min read Design Amazon's Product Catalog Design Amazon's product catalog: a 350M-item database with real-time inventory, per-seller pricing, product search with faceted filtering, and the availability guarantee that drives 'Buy Now' at Black Friday scale. Senior Commerce 23 min read Design Discord Design Discord's real-time messaging infrastructure: persistent WebSocket fleet across millions of connections, guild sharding, voice channel SFU, online presence at scale, and the Cassandra message store behind 4 billion messages per day. Senior 23 min read Design DoorDash Design DoorDash's food delivery platform: restaurant catalog with real-time menu updates, three-sided marketplace matching (customer → restaurant → Dasher), order state machine, real-time delivery tracking, and the operational complexity of coordinating kitchen prep time with Dasher arrival. Senior Commerce 23 min read Design an Email Service Design a Gmail-scale email service: SMTP ingestion, anti-spam pipeline, conversation threading, full-text search, and the deliverability engineering that keeps your IP reputation clean at 15 billion emails per day. Senior 22 min read Design Facebook News Feed Design Facebook's News Feed at 3 B MAU — from EdgeRank's original graph-walk model to modern ML ranking with thousands of signals. Tackle write amplification, story deduplication, and privacy-aware feed generation. Staff 26 min read Design Instagram Design Instagram end-to-end: photo/video upload pipeline, ranked home feed, ephemeral Stories with 24-hour TTL, and the Explore page. Balance write amplification against read-latency at 2 B MAU. Senior 24 min read Design LinkedIn's People You May Know Design LinkedIn's social graph storage and the 'People You May Know' recommendation engine: BFS over a billion-node graph, 2nd-degree connection queries, common connection counting, and the real-time ranking pipeline that surfaces relevant suggestions. Senior 22 min read Design Netflix Design Netflix's video streaming platform: content ingestion with Mezzanine encoding, Open Connect CDN with ISP-embedded appliances, adaptive bitrate streaming, DRM, and the collaborative filtering recommendation engine behind 80% of content discovery. Staff Media 27 min read Design Reddit Design Reddit: the voting system, hot/top/new feed ranking, nested comment trees at depth, subreddit fan-out, and the caching strategy that keeps 1.5 B monthly visitors from melting the database. Senior 22 min read Design Slack Design Slack's workspace messaging: channel fan-out for millions of members, WebSocket fleet management, threaded message model, cross-workspace search, and the engineering choices behind @ notifications at scale. Senior 23 min read Design Spotify Design Spotify's audio streaming platform: track storage and CDN delivery, playlist management at scale, the Discover Weekly recommendation pipeline (collaborative filtering + NLP on playlist co-occurrence), and offline playback with license management. Senior Media 22 min read Design a Stock Trading Exchange Design a stock trading exchange: the order book data structure, price-time priority matching engine, FIX protocol order ingestion, market data fan-out, and the correctness guarantees that prevent phantom fills and duplicate executions at microsecond latency. Staff Real-time 28 min read Design Stripe's Payment Gateway Design Stripe's payment processing infrastructure: idempotent charge API, card tokenization and PCI-DSS scope isolation, the double-entry ledger for financial correctness, webhook delivery with at-least-once guarantees, and distributed money movement without distributed transactions. Staff Commerce 26 min read Design Ticketmaster Design Ticketmaster: seat reservation with atomic hold-and-pay, virtual waiting queues for Taylor Swift on-sale moments (1M users hitting simultaneously), seat map rendering, and the consistency requirements that make ticket booking harder than e-commerce. Senior Commerce 22 min read Design TikTok/Reels Design TikTok's short-form video platform: upload pipeline, the For You Page recommendation engine that drives 70% of watch time, cold-start for new creators, edge-cached pre-loading for instant playback, and content moderation at 100M videos per day. Senior Media 23 min read Design Twitch Live Streaming Design Twitch's live streaming infrastructure: RTMP ingest, real-time transcoding to HLS at multiple qualities, low-latency delivery (3s vs 20s trade-off), global CDN fan-out for 100K concurrent viewers, chat at millions of messages per minute, and VOD storage. Senior Media 23 min read Design Twitter's Home Timeline Build a home timeline feed that shows tweets from followed accounts in near-real-time. Navigate the fan-out trade-off, the celebrity problem, and Redis cache invalidation at 300 M DAU. Senior 22 min read Design Uber Ride Matching Design Uber's ride matching system: real-time driver location ingestion at 1M updates/second, geohash-based nearest driver lookup, matching algorithm, surge pricing via supply-demand imbalance, and the trip state machine from request to payment. Senior Commerce 24 min read Design WhatsApp Messenger Build WhatsApp's 1:1 and group messaging at 2 B users: Signal Protocol E2E encryption, offline message queuing, online presence at scale, and the engineering trade-offs behind 'last seen' and read receipts. Senior 24 min read Design YouTube Design YouTube end-to-end: video ingestion and transcoding pipeline, adaptive bitrate streaming with HLS/DASH, global CDN delivery, the watch-next recommendation system, and the engineering trade-offs behind serving 1 billion hours of video daily. Staff Media 28 min read Design Zoom Video Conferencing Design a video conferencing system like Zoom: WebRTC peer negotiation, SFU vs MCU topologies, simulcast for adaptive quality, jitter buffer management, and the network engineering behind 1-second latency for 1,000-person webinars. Senior 24 min read Design an API Gateway / Service Mesh Design the API Gateway and service mesh layer that handles cross-cutting concerns — rate limiting, authentication, mTLS, traffic shifting for canary deploys, circuit breaking, and retry budgets — so individual microservices don't need to implement these themselves. Senior Infra 23 min read Design a CDN Design a global CDN that serves static assets with < 20ms latency worldwide using Anycast routing, a multi-tier cache hierarchy, and intelligent cache purge propagation — covering PoP placement, origin shield, cache key design, and edge computing for dynamic content. Senior Infra 21 min read Design a CI/CD Pipeline at Scale Design a CI/CD platform that runs 10,000 builds per day, scales worker capacity elastically, caches build artifacts to avoid redundant work, and provides safe progressive delivery — covering DAG scheduling, sandbox isolation, build cache deduplication, and canary deployment automation. Senior Infra 20 min read Design a Consistent Hashing & Sharding Service Design the ring-based consistent hashing algorithm that powers DynamoDB and Cassandra — covering virtual nodes, rebalancing cost, hotspot prevention, and when to use jump hash instead. Senior Foundations 20 min read Design a Distributed Cache Design a distributed in-memory cache supporting sub-millisecond reads, multiple eviction policies, and horizontal sharding — covering write strategies, hot-key mitigation, and cache invalidation, which is famously one of the two hard problems in CS. Senior Foundations 24 min read Design a Distributed Job Scheduler Design a distributed cron-like scheduler that triggers millions of jobs per day with exactly-once semantics, survives node failures without missed or duplicate triggers, and supports DAG-based workflows — covering leader election, idempotency, and backfill strategies. Senior Infra 21 min read Design a Distributed KV Store Design an eventually-consistent, leaderless distributed key-value store in the style of Amazon Dynamo — covering quorum reads and writes, vector clocks for conflict resolution, gossip-based membership, Merkle trees for anti-entropy, and sloppy quorums for availability under partitions. Staff Foundations 28 min read Design a Distributed Locking Service Design a distributed lock service that provides mutual exclusion across processes with lease-based expiry, fencing tokens to handle GC pauses, and Raft consensus for correctness — the primitives behind leader election, distributed coordination, and config management. Staff Foundations 26 min read Design a Distributed Logging System Design a logging pipeline that ingests billions of structured log lines per day, supports full-text search with sub-second latency, and implements hot/warm/cold tiering to control storage costs — covering sampling strategies, schema design, and query performance. Senior Infra 20 min read Design a Distributed Rate Limiter Build a distributed rate limiter that enforces per-user and per-endpoint quotas at millions of requests per second, with sub-millisecond overhead and no single point of failure. Mid Foundations 22 min read Design a Distributed Unique ID Generator Design a service that generates globally unique, roughly time-sortable 64-bit IDs at millions per second across distributed nodes — covering Snowflake layout, clock skew handling, and monotonicity guarantees without coordination. Mid Foundations 16 min read Design Dropbox / Google Drive Design a cloud file storage service that syncs files across devices in near-real-time using block-level deduplication, delta sync (only transfer changed blocks), and conflict resolution — handling 100M users and petabytes of storage. Senior Storage 23 min read Design Google Maps + Routing Design the core systems behind Google Maps: a tile-based map rendering pipeline, a routing engine using Contraction Hierarchies for sub-second driving directions on billions of edges, and a real-time traffic ingestion system that continuously updates route weights. Senior Search & Maps 22 min read Design Google Search Design a web-scale search engine covering the full pipeline: crawling and indexing billions of documents with an inverted index, scoring with BM25 + PageRank, distributed query execution across thousands of index servers, and real-time index updates for freshness. Staff Search & Maps 27 min read Design a Distributed File System (HDFS) Design a distributed file system in the style of HDFS and GFS — covering NameNode/DataNode architecture, block replication with rack awareness, NameNode HA using Quorum Journal Manager, and the write-once-read-many access model that enables MapReduce-style workloads at petabyte scale. Staff Storage 24 min read Design a Metrics & Monitoring System Design a time-series metrics system that collects billions of data points per day, stores them with 10× compression, evaluates alerting rules in near-real-time, and supports ad-hoc queries — covering pull vs push, cardinality limits, Gorilla compression, and downsampling. Senior Infra 22 min read Design a Multi-channel Notification System Design a notification platform that routes events to push (FCM/APNs), email (SendGrid), and SMS (Twilio) channels — covering fanout strategies, exactly-once delivery semantics, user preference management, and rate limiting per channel. Senior Foundations 21 min read Design Photo Storage at Scale Design a purpose-built photo storage system in the style of Facebook Haystack — storing hundreds of billions of photos with sub-millisecond disk lookup by packing many small objects into large files, eliminating filesystem metadata overhead, and aggressive cold tiering. Senior Storage 19 min read Design S3-like Object Storage Design a petabyte-scale object storage system supporting 11 nines of durability using erasure coding, multi-region replication, and an eventually-consistent bucket listing — covering data placement, multipart upload, storage classes, and lifecycle policies. Staff Storage 26 min read Design a Top-K / Trending System Design a system that identifies the top-K most frequent items (trending hashtags, popular videos, heavy-hitter IPs) in a stream of billions of events — covering Count-Min Sketch for frequency estimation, HyperLogLog for distinct count, and a two-tier aggregation pipeline. Senior Foundations 19 min read Design Typeahead / Autocomplete Design a typeahead suggestion service that returns top-K search completions in < 50ms — covering trie sharding, prefix caching in Redis, personalization layer, and the data pipeline that keeps suggestions fresh from query logs. Mid Search & Maps 16 min read Design a URL Shortener Build a URL shortening service handling 100M new URLs/day and 10B redirects/day — the classic read-heavy, write-light system that tests your caching, hashing, and storage intuitions. Mid Foundations 18 min read Design a Web Crawler Design a distributed web crawler that discovers and indexes billions of pages — balancing politeness (robots.txt, rate limits per domain), deduplication at scale (Bloom filters + URL fingerprinting), and recrawl scheduling (freshness vs cost). Senior Foundations 22 min read Design Yelp / Nearby Places Design a proximity search service that finds businesses near a given location — covering geohash indexing, ranking by distance and rating, review aggregation at scale, and the write path for new businesses and reviews. Mid Search & Maps 17 min read