System design, the way Google asks it.
100 system design questions reported from Google interviews, the 77 concepts they are built from, and every one of the 100 solved in the same six-step framework.
How to read these notes
Two halves. Concepts are the building blocks: each article starts from a situation a student can picture, builds the mechanism one piece at a time, puts numbers on why it works, and says out loud what it costs. The 100 problems are the questions candidates report from Google loops, each solved the same way: requirements with numbers, core entities, the API, a high-level design with a diagram, three or four deep dives written as the questions an interviewer actually asks, and what a strong answer sounds like. Every solution links the concepts it uses, and every concept lists the problems it appears in.
Read the concepts first if system design is new to you; read a problem first if you have an interview next week and want the rhythm. The sidebar ticks what you have finished, in this browser only.
Concepts
Fundamentals
The vocabulary every design starts from.
- API design The contract between caller and service: resources, verbs, pagination, versioning and errors.
- Load balancing Spreading requests over many servers so no one machine decides your latency.
- Sharding and partitioning Splitting data by key so each machine holds a slice it can handle.
- Replication Keeping copies so reads scale and a dead machine loses nothing.
- Back-of-the-envelope capacity planning Turning users and bytes into machines, with arithmetic an interviewer can follow.
- Consistency models What a reader is promised about writes they did not see happen.
- Separate metadata from content Small hot records in a database, big cold bytes in object storage.
- Precompute or compute on the fly Paying at write time or at read time, and how to tell which is cheaper.
- Pagination with cursors Returning a big list a page at a time without skipping or repeating.
- Versioning data and APIs Keeping old readers and old records working while things change.
Storage and data
Where the bytes live and how they are found.
- Key-value stores The simplest database: a hash map spread over machines.
- LSM trees and B-trees The two ways disks store sorted data, and why writes and reads favour different ones.
- Wide-column stores (Bigtable) Sorted rows with sparse columns: range scans over petabytes.
- Object and blob storage Immutable files by name, replicated and cheap.
- Chunking and deduplication Cutting files into pieces so uploads resume and repeats are stored once.
- Content addressing Naming data by the hash of its bytes, so equal things share a name.
- Consistent hashing Assigning keys to machines so adding one machine moves only a few keys.
- Inverted indexes From every word to the documents that contain it: how search answers in milliseconds.
- Tries and top-K for prefixes A tree of characters with the best completions stored at each node.
- Geospatial indexing Geohashes, quadtrees and S2 cells: turning 'nearby' into a range query.
- Time-series storage Append-only metrics with compression, downsampling and retention.
- Graph storage Adjacency lists at scale and why hops get expensive.
- Sorted sets and leaderboards Keeping millions of scores ordered with O(log n) updates.
- Write-heavy workloads Absorbing millions of writes a second with batching, append-only logs and partitioning.
- Erasure coding Durability with less than three copies: parity across machines.
- Double-entry ledgers Recording money as paired entries so totals always balance and history is immutable.
Caching and edges
Answering from memory and from nearby.
- Caching strategies Read-through, write-through, write-back, TTLs and invalidation.
- Cache stampedes and hot keys What happens when a popular key expires, and the locks and jitter that prevent it.
- CDNs and edge caching Copies of static bytes near the user, and how they stay fresh.
- Bloom filters A tiny set that says 'definitely not here' for almost no memory.
- Counters and approximate counting Exact counters that shard, and sketches that count billions in kilobytes.
Queues, streams and batch
Doing work later, elsewhere, and in bulk.
- Message queues and pub/sub Decoupling producers from consumers with a durable log in between.
- Idempotency and exactly-once Making a repeated request harmless, which is how 'exactly once' is really built.
- Asynchronous workers Taking slow work off the request path and reporting back later.
- Fan-out on write versus fan-out on read Pushing a post to every follower's inbox, or assembling the feed when asked.
- Stream processing Windows, watermarks and late events: computing over data as it arrives.
- Batch versus streaming (MapReduce and friends) Exact answers over everything at night, or approximate answers now.
- Job scheduling Running work on time, once, with dependencies and retries.
- Backpressure and load shedding Slowing producers down instead of falling over.
- Rate limiting Token buckets, sliding windows, and enforcing them across many servers.
- Retries, timeouts and backoff Retrying without creating the storm that takes the service down.
- Circuit breakers Failing fast when a dependency is sick, and probing to recover.
- Deduplication by hashing Spotting repeats of URLs, events or files with fingerprints.
- Sampling Keeping a representative fraction when you cannot keep everything.
Coordination and consistency
Agreeing on one truth across many machines.
- Consensus (Paxos and Raft) How machines agree on one value even when some of them crash.
- Leader election Picking one machine to decide, and replacing it when it dies.
- Distributed locks and leases Mutual exclusion across machines, and why a lease needs a clock.
- Distributed transactions (2PC and sagas) All-or-nothing across services, or a sequence of steps with compensations.
- Clocks and ordering Why machines disagree about time, and how to order events anyway.
- Unique ID generation IDs that are unique, roughly ordered and made without a central counter.
- Quorums Reading and writing enough copies that the two always overlap.
- Sync and conflict resolution Merging edits from devices that worked apart.
- Operational transforms and CRDTs Letting people edit the same text at once and converge.
Real-time and media
Pushing changes to people as they happen.
- WebSockets, long polling and SSE Keeping a connection open so the server can speak first.
- Presence and heartbeats Knowing who is online and when someone silently vanished.
- Push notifications Reaching a device that is asleep, through APNs and FCM.
- Video transcoding Turning one upload into many renditions, in parallel, by segment.
- Adaptive bitrate streaming HLS and DASH: the player picks the quality the network can carry.
- WebRTC and selective forwarding units Real-time calls: peer-to-peer for two, a forwarding server for a hundred.
- Routing on road graphs Shortest paths on a planet-sized graph, precomputed enough to answer in milliseconds.
Reliability and operations
Staying up when parts fail.
- Failure detection and health checks Telling a slow machine from a dead one, quickly and without false alarms.
- Multi-region and failover Running in several places so one disaster is a bad hour, not a bad week.
- Observability: metrics, logs and traces The three signals that explain why a request was slow.
- Safe rollouts Canaries, waves and instant rollback.
- TTLs and expiry Making data disappear on time without a sweep over everything.
- Abuse, spam and fraud signals Finding the bad actors in the traffic without blocking the good ones.
- Scatter-gather Asking every shard and merging the answers, and the tail latency it brings.
Security and privacy
Who may do what, and keeping secrets secret.
- Authentication and authorization Proving who you are, and checking what you may do, on every request.
- Encryption and key management Keys that encrypt keys, rotation, and hardware that never gives up a secret.
- Privacy and PII handling Minimising, isolating and deleting personal data on purpose.
- Prompt injection defences Treating model input as untrusted data and limiting what a model can do.
ML and AI serving
Models as part of the system.
- Recommendation system architecture Candidate generation, ranking and re-ranking under a latency budget.
- Embeddings and nearest-neighbour search Turning items into vectors and finding similar ones in milliseconds.
- Feature stores The same features at training time and serving time.
- Ranking pipelines Scoring thousands of candidates in stages, cheap first, expensive last.
- Model serving Batching, GPUs, caching and streaming tokens behind an SLO.
- A/B testing and experimentation Assigning users consistently and measuring a difference you can trust.
The 100 problems, solved
Storage and files
Files, objects, photos and the databases under them.
- 001 · Design Google Drive Upload, version, share and sync files across devices without losing an edit.
- 002 · Design a distributed file system (GFS) Petabytes of large files on thousands of cheap machines, with a master that never becomes the bottleneck.
- 003 · Design a blob / object storage service (Google Cloud Storage) Store and serve billions of immutable objects with eleven nines of durability.
- 004 · Design Google Photos Back up every photo from a phone, find any of them by content, and show a memory from this day years ago.
- 005 · Design an image and GIF hosting service without sign-up Anonymous uploads served worldwide, with abuse handled and bandwidth-limited clients in mind.
- 006 · Design Street View image ingestion and storage Cars and taxis upload terabytes of imagery a day; stitch, index by location and serve a panorama in under a second.
- 007 · Design a distributed key-value store A billion keys, single-digit-millisecond reads, survive a machine dying mid-write.
- 008 · Design Bigtable: a wide-column store Sparse, sorted, petabyte tables with range scans and single-row atomicity.
- 009 · Design a globally consistent, multi-region database (Spanner) Transactions across continents that look serial, plus online schema changes and hot-key relief.
- 010 · Design deduplicated multi-tenant file storage Store the same bytes once across millions of tenants without leaking who else has them.
- 011 · Design a URL shortener Billions of short links, custom aliases, 100:1 read to write, and nothing ever collides.
Search and indexing
Crawling, indexing, ranking and typeahead.
- 012 · Design a web crawler Fetch billions of pages politely, dedupe them, and keep the index fresh.
- 013 · Design Google Search From a crawl to a ranked ten blue links in 200 ms: index, serve, rank.
- 014 · Design search autocomplete Suggest the top completions for a prefix in under 100 ms as the world types.
- 015 · Design Twitter search Index every tweet within seconds and answer keyword and hashtag queries over the recent past.
- 016 · Design a distributed search engine like Elasticsearch Shards, replicas, scatter-gather and relevance over user documents.
Social and feeds
Timelines, counters, comments and what is trending.
- 017 · Design a social news feed (Twitter / Facebook) A timeline for 500 million users where a celebrity post reaches 50 million followers.
- 018 · Design Instagram Photo posts, follows, a home feed and explore, with uploads that never block the app.
- 019 · Design the stories feature (24-hour posts) Ephemeral posts that expire on the dot, with view receipts and a fast tray.
- 020 · Design a comments service Nested comments on billions of posts with moderation, pagination and hot threads.
- 021 · Design like and view counters Count a billion likes a day, show a number that is fresh enough, never double-count.
- 022 · Design trending topics / top-K over a sliding window The top 10 hashtags or songs in the last hour, updated every few seconds, across all regions.
- 023 · Design Google News Cluster the world's articles into stories, rank them per reader and keep the front page minutes fresh.
- 024 · Design LinkedIn-style connection degrees (1st, 2nd, 3rd) Tell two members how far apart they are, in milliseconds, on a graph that does not fit in memory.
- 025 · Design a real-time game leaderboard Rank millions of players globally and show a player's rank and neighbours instantly.
Messaging and notifications
Chat, email, push and pub/sub at scale.
- 026 · Design a chat app (WhatsApp / Google Chat) One-to-one and group messages, delivery receipts, offline users, and 10 million concurrent connections.
- 027 · Design a notification system Push, SMS and email to a billion devices with priorities, dedup, rate limits and opt-outs.
- 028 · Design Gmail Receive, store, search and label a trillion emails; open any mailbox in a blink.
- 029 · Send 100 million emails with five machines A NALSD-style capacity problem: templates, SMTP limits, retries and what five machines can actually push.
- 030 · Design live chat for a YouTube live stream A million viewers in one chat: fan-in of messages, fan-out to everyone, with moderation.
- 031 · Design Google Meet Real-time audio and video for a 100-person call with mute, share and recording.
- 032 · Design a managed pub/sub or message queue with replay Topics, consumer groups, at-least-once delivery, ordering per key and replay from a timestamp.
Video and media
Upload, transcode, distribute and play.
- 033 · Design YouTube Upload a video, transcode it into many renditions, and play it to a billion people.
- 034 · Design a video distribution CDN Edge caches worldwide that serve 80 percent of bytes without touching origin.
- 035 · Design Spotify Stream songs instantly, build playlists, and make shuffle feel random without repeats.
- 036 · Design TikTok Short videos, an endless personalised For You feed, and uploads that go live in seconds.
Maps and location
Routing, nearby search, live location and dispatch.
- 037 · Design Google Maps Tiles, routing, ETA and live traffic for the planet, loading in under 100 ms.
- 038 · Design nearby places search (NALSD) 300 million places, 10 billion queries a day, return the nearest in 8 ms on given hardware.
- 039 · Design Uber Match riders to the nearest drivers in seconds while every driver moves.
- 040 · Collect GPS data and show live traffic on a map Phones report positions; aggregate them into road speeds and paint the map within a minute.
- 041 · Visualize 100 million points on a map Cluster, tile and stream points so the browser never holds more than it can draw.
Commerce, booking and payments
Inventory, holds, orders, auctions and money.
- 042 · Design Ticketmaster Sell 50,000 seats in a minute without selling one twice; hold, pay, release.
- 043 · Design an e-commerce site Catalogue, cart, checkout and orders, with inventory that is never oversold.
- 044 · Design a concurrent online auction Thousands of bids a second on one item, a strict winner, and no bid lost at the buzzer.
- 045 · Design an inventory management system Stock counts across warehouses that stay correct under concurrent orders and returns.
- 046 · Design a personalized deals and promotions service Weekly deals per shopper, nearby-store alerts, and a sale that goes live for everyone at once.
- 047 · Design Google Pay Move money between accounts with exactly-once semantics, fraud checks and an audit trail.
- 048 · Design the Play Store revenue split and developer payout flow Aggregate billions of purchases into monthly developer payouts, with refunds and tax, correct to the cent.
- 049 · Design a stock trading system with a limit order book Match orders in microseconds with a strict price-time priority and a durable trail.
- 050 · Design a service that shows the latest stock prices worldwide Ingest ticks from every exchange and show every user the latest price within a second.
- 051 · Design a restaurant waitlist Join a queue, get a table estimate, be paged when ready; a coding-plus-design hybrid.
- 052 · Design a global restaurant menu update system Owners edit menus, every surface worldwide shows the new price within a minute.
Collaboration and productivity
Documents, calendars, sync and small apps.
- 053 · Design Google Docs Many people type in one document and all see the same text, with history and offline edits.
- 054 · Design Google Calendar Events, invitations, recurring rules and conflict detection across time zones.
- 055 · Design an offline-first client that syncs and resolves conflicts Edit on a plane, sync on landing, and merge with what the other device did meanwhile.
- 056 · Design job alerts for Google Careers Match new postings to saved searches for millions of candidates and notify them once.
- 057 · Manage user preferences across many Google products One settings store that every product reads in a millisecond and writes safely.
- 058 · Design a source control system Commits, branches, merges and blame for a monorepo with thousands of engineers.
Infrastructure and platform
The services other services are built on.
- 059 · Design a distributed rate limiter Allow N requests per key per second across many servers without a central bottleneck.
- 060 · Design a Drive-style usage quota limiter Enforce storage and API quotas per user and per project with soft limits and grace periods.
- 061 · Design a distributed cache A memory tier across machines with eviction, consistent routing and no stampede when a key expires.
- 062 · Design a load balancer Spread traffic across healthy servers at layers 4 and 7, drain gracefully, never be a single point of failure.
- 063 · Design a high-scale API gateway Ten million requests a second: auth, routing, throttling and observability at the door.
- 064 · Design a distributed unique ID generator Billions of unique, roughly ordered IDs a day from many machines with no coordination on the hot path.
- 065 · Design a distributed job scheduler Cron at scale: run jobs on time, exactly once, with dependencies and retries.
- 066 · Design a scheduler for long-running GPU jobs Place opaque multi-hour jobs on scarce GPUs, preempt fairly, checkpoint and resume.
- 067 · Design a distributed lock service (Chubby) Coarse-grained locks and leases that stay correct through partitions and leader crashes.
- 068 · Design a global configuration and feature-flag service Change a flag and have a million servers see it within seconds, safely and in order.
- 069 · Design cross-service transactions (sagas and 2PC) Move money and reserve stock across services without a global lock.
- 070 · Design a key management service Generate, store, rotate and use encryption keys at 3,000 operations a second with strict audit.
- 071 · Design a distributed IP denylist and country ban enforcement Block listed IPs and whole countries at every edge within seconds, for IPv4 and IPv6.
- 072 · Design fraud and DDoS protection for a social service Tell a million real users from a botnet at the edge and in the login path.
- 073 · Build an authentication platform Passwords, sessions, OAuth and two-factor for a billion accounts with no single key to steal.
- 074 · Design a global code deployment pipeline Ship a build to 100,000 machines across regions, in waves, with instant rollback.
- 075 · Upgrade 5,000 servers without downtime Roll a kernel and service upgrade across a fleet while serving traffic the whole time.
- 076 · Design a CI system that runs a million tests in ten minutes Shard tests across a fleet, cache what has not changed, and report flakes honestly.
- 077 · Design a service that depends on slow and unreliable APIs Keep your p99 under control when third parties take seconds or fail.
- 078 · Scale a web application to handle a 10x traffic surge A launch or an outage elsewhere sends ten times the load; survive it without a rewrite.
- 079 · Handle a fire in a data center A region goes dark in seconds; keep the service up and the data intact.
Data pipelines and operations
Logs, metrics, analytics, migrations and rollouts.
- 080 · Design a log collection and aggregation pipeline Terabytes of logs an hour from every machine, searchable within a minute, retained for a year.
- 081 · Design a metrics and monitoring system Millions of time series, alerts in under a minute, dashboards over a year of data.
- 082 · Design server health monitoring and failure detection Know within seconds which of a million machines is sick, without the monitor itself melting.
- 083 · Design distributed tracing for a microservice fleet Follow one request through 200 services and find where the 300 ms went.
- 084 · Design a real-time analytics pipeline Billions of events a day, dashboards that lag by seconds, and exact daily totals by morning.
- 085 · Count ad clicks and YouTube Shorts views in real time Per-ad and per-video counts every minute, exact billing by end of day, with late and duplicate events.
- 086 · Design a data lake ingestion layer Land every event and table change into cheap storage with schemas, partitions and exactly-once files.
- 087 · Design an A/B experimentation platform Assign users to experiments consistently, log exposures, and compute statistics you can trust.
- 088 · Sort 1 TB on 1,000 machines with 1.5 GB RAM each A classic MapReduce-shaped question: partition, sort locally, merge, and handle a slow machine.
- 089 · Move 100 petabytes from the US East Coast to the West Coast Trucks or fibre: work out the time, the cost and how to verify every byte.
- 090 · Migrate live users from NoSQL to SQL without downtime Dual-write, backfill, verify and cut over while the product keeps running.
- 091 · Migrate a monolith to microservices Carve a legacy core service apart in phases without a big-bang cutover.
ML and AI systems
Recommendation, ads, LLM serving and ML in production.
- 092 · Design a recommendation system Candidate generation, ranking and re-ranking for YouTube or a feed, under a 200 ms budget.
- 093 · Design an ad-serving system Pick the best ad for a search in 50 ms: targeting, auction, budgets and pacing.
- 094 · Design LLM serving infrastructure Serve a large model to millions with batching, KV caches, streaming tokens and a latency SLO.
- 095 · Design a retrieval-augmented generation pipeline Ground answers in a fresh corpus: chunk, embed, retrieve, rerank, generate, cite.
- 096 · Distribute large ML model files across a serving fleet Push a 100 GB model to 10,000 servers in minutes without crushing the network.
- 097 · Monitor an ML model's performance in real time Detect drift, skew and a bad rollout from live predictions and delayed labels.
- 098 · Summarise e-commerce reviews with an LLM, safely Batch and on-demand summaries with prompt-injection and PII defences and a cost ceiling.
- 099 · Design customer support with virtual-agent-to-human escalation A bot handles the easy half, hands the rest to people with full context, and learns from the outcome.
- 100 · Design Google Home Wake word to answer in under a second: speech, intent, fulfilment and devices.