System Design (High-Level Design)
System Design (High-Level Design) practice
194 exercises and 200 quizzes from the lessons of this track. Sample tests run in your browser; what you pass is kept in this browser only.
Start here: how system design works
- Quiz: What system design is and what a design round tests
- Send back the requirements that cannot be checked
- Quiz: Turning a vague prompt into requirements
- Turn an availability target into a downtime budget
- Quiz: Quality attributes and how to trade them off
- Tell a practice timer which step you should be on
- Quiz: A step-by-step framework for a design round
- Number and name a new decision record
- Quiz: Diagrams, design docs and decision records
- Find the resource that fills up first
- Quiz: Growing a service from one server to many regions
Back-of-the-envelope estimation
- Convert sizes to bytes and counts to rates
- Quiz: Units, powers of two and time conversions
- Compute the speed-of-light floor of a round trip
- Quiz: Latency numbers, measured on real hardware
- Turn users into average and peak requests per second
- Quiz: Estimating traffic: users to requests per second
- Size storage, bandwidth and a cache's hot set
- Quiz: Estimating storage, bandwidth and cache memory
- Size concurrency, a connection pool and a fleet
- Quiz: Little's law, utilisation and server counts
- Fill in the estimate sheet of a paste service
- Quiz: Estimation drills: five systems end to end
Performance and reliability fundamentals
- Percentiles from a sample and from merged bucket counts
- Quiz: Latency, throughput and percentiles
- Size the tail of a fan-out and pick a hedge delay
- Quiz: Tail latency at scale: fan-out and hedging
- What adding instances can and cannot buy
- Quiz: Scaling up, scaling out and stateless services
- Downtime budgets and composite availability
- Quiz: Availability maths: nines, series and parallel
- An error budget, what is left of it, and how fast it burns
- Quiz: SLIs, SLOs, SLAs and error budgets
- A payment server that charges once per idempotency key
- Quiz: How distributed systems fail
- Capped exponential backoff with full jitter
- Quiz: Timeouts, retries, backoff and jitter
- The three states of a circuit breaker
- Quiz: Circuit breakers, bulkheads and shuffle sharding
- Admit by priority, and say when to come back
- Quiz: Load shedding, backpressure and degradation
- Size a fleet that survives the loss of a zone
- Quiz: Redundancy, failover and static stability
Networking for system designers
- Predict the time to the first byte from round trips
- Quiz: The life of a web request, hop by hop
- Count the round trips before the first byte
- Quiz: TCP, QUIC, HTTP/1.1 to HTTP/3 and TLS 1.3
- Choose the longest TTL that still meets a failover goal
- Quiz: DNS, GeoDNS and anycast for system design
- Route requests by the longest matching path prefix
- Quiz: Forward proxies, reverse proxies and gateways
- Track health checks and fail open
- Quiz: Load balancing: L4 vs L7 and health checks
- Write the choices of four balancing policies
- Quiz: Load-balancing algorithms, from round robin up
- Normalise a URL into an edge cache key
- Quiz: CDNs and edge caching
APIs and communication patterns
- Decide when a client may retry, and how long it waits
- Quiz: API styles and HTTP semantics for designers
- The idempotency check in front of a payment handler
- Quiz: Idempotency keys and safe retries
- Keyset pages over a SQLite table, with a has-more check
- Quiz: Pagination at scale: offset, cursor and keyset
- A consumer that survives redelivery and reordering
- Quiz: Synchronous vs asynchronous communication
- Resume a message stream from the client's cursor
- Quiz: Real-time delivery: polling, SSE and WebSockets
- Verify a signed webhook, with a timestamp window and two secrets
- Quiz: Webhooks: signing, retries and replay defence
- Fix the four flaws of a token check
- Quiz: Authentication and authorisation for services
Data modelling and storage engines
- Build the order document a screen reads, and pay for its copies
- Quiz: Choosing a data model: relational to vector
- Normalise a flat order table without losing a row
- Quiz: Relational modelling and deliberate denormalisation
- Choose three indexes that turn scans into searches
- Quiz: Database indexes: how they work, when they help
- Read the newest value from a toy LSM tree
- Quiz: Storage engines: B-trees vs LSM-trees
- Retry a whole transaction after a serialization failure
- Quiz: Transactions, isolation levels and anomalies
- Reserve stock in one statement that cannot oversell
- Quiz: Optimistic vs pessimistic locking, and MVCC
- Make a migrated copy converge, whatever the order of arrival
- Quiz: SQL or NoSQL: a decision procedure
- Run-length encode a column and count without decoding
- Quiz: OLTP vs OLAP: row stores, column stores, warehouses
Caching
- Plan where eight kinds of shop data may be cached
- Quiz: Where caches live, from browser to database
- Implement get and put for a cache-aside store
- Quiz: Cache-aside, read-through, write-through, write-back
- Build an LRU cache whose get and put take constant time
- Quiz: Eviction policies and cache sizing
- Refuse stale cache fills with a version check
- Quiz: Cache invalidation and consistency
- Coalesce concurrent loads of the same key
- Quiz: Cache stampedes, hot keys and negative caching
- Write Cache-Control headers for six responses
- Quiz: HTTP caching semantics for system designers
Replication
- Apply a stream of row changes exactly once
- Quiz: Leader-follower replication and replication logs
- Build a store that refuses stale fencing tokens
- Quiz: Failover, split brain and fencing
- Route a read with the session's position token
- Quiz: Replication lag and read-your-writes guarantees
- Write a grow-only counter that merges safely
- Quiz: Multi-leader replication and conflict resolution
- Combine a quorum read and plan its read repair
- Quiz: Leaderless replication and quorums: N, R and W
Partitioning and sharding
- Route queries to the partitions they must read
- Quiz: Partitioning: vertical, horizontal, range and hash
- Build a hash ring and find a key's owner
- Place replicas on distinct nodes, with weights
- Quiz: Consistent hashing and rendezvous hashing
- Split a hot counter into enough keys
- Quiz: Hot partitions, celebrity keys and key salting
- Read through an index table that can be wrong
- Quiz: Secondary indexes across shards
- Schedule partition moves so no node is in two at once
- Quiz: Rebalancing and online resharding
- Fix a router that trusts a stale partition map
- Quiz: Request routing and multi-tenant partitioning
Consistency, time and coordination
- Check whether an order linearises a history
- Quiz: Consistency models, from linearisable to eventual
- How long a replicated write waits
- Quiz: CAP and PACELC, stated correctly
- Vector timestamps for a message diagram
- Quiz: Clocks and ordering: Lamport, vector and HLC
- The Raft leader's commit rule
- Quiz: Consensus in practice: what Raft gives you
- A storage stub that refuses stale leaders
- Quiz: Leader election, leases and fencing tokens
- A lock from an object store's conditional writes
- Quiz: Distributed locks: when they are safe
Distributed transactions and workflows
- Find the crash points that lose an event or an order
- Quiz: Dual writes and two-phase commit
- Plan a saga's recovery and check where its pivot sits
- Quiz: Sagas: orchestration, choreography, compensation
- Write the relay step that publishes and marks outbox rows
- Quiz: The outbox pattern, CDC and idempotent consumers
- Quiz: Exactly once: what it really means
- Remove the three replay bugs from a refund workflow
- Quiz: Durable execution and workflow engines
Messaging and stream processing
- Give each reader group of a log its own offset
- Quiz: Queues, logs and pub-sub: three different tools
- Decide between a retry and the dead-letter queue
- Quiz: Delivery guarantees, retries and dead letters
- Find the highest offset a consumer may commit
- Quiz: Ordering, partition keys and consumer groups
- Work out a backlog's peak and when it drains
- Quiz: Queue-based load levelling and backlogs
- Count tumbling windows behind a watermark
- Quiz: Stream processing: windows, event time, watermarks
- Spread a hot key over several reducers and merge it back
- Quiz: Batch processing and lakehouse architectures
Architecture styles at scale
- Find the calls and table reads that cross module boundaries
- Quiz: Monolith, modular monolith or microservices?
- A service registry that forgets silent instances
- Quiz: Service discovery, sidecars and service meshes
- Quiz: Serverless and edge computing: when they fit
- Rebuild an account from its events
- Quiz: Event-driven design, event sourcing and CQRS
- A cell router that pins tenants and never spills
- Quiz: Cells, deployment stamps and blast radius
- Compare a shadow answer with the legacy one
- Quiz: Migrating live systems: strangler fig and ACL
Search, geospatial and probabilistic data structures
- Score one term with BM25
- Quiz: Inverted indexes, analysers and BM25 ranking
- Match Indian-script titles from queries in any script
- Quiz: Search for Indian languages and mixed scripts
- Build a trie that keeps the top suggestions
- Quiz: Typeahead: tries and top-k per prefix
- Find the cells around a geohash cell
- Quiz: Geospatial indexing: geohash, quadtrees, S2, H3
- Add to a Bloom filter and check membership
- Quiz: Bloom and cuckoo filters: membership at scale
- Merge two HyperLogLog sketches
- Quiz: HyperLogLog, Count-Min and heavy hitters
- Measure the recall of an approximate index
- Quiz: Vector search for system designers
Files, objects and media
- Price storage classes with their minimum billable size
- Quiz: Block, file and object storage
- Read an erasure-coding policy and place it across zones
- Quiz: Durability: replication vs erasure coding
- Plan the parts of a multipart upload and resume it
- Quiz: Large uploads: multipart, resumable and presigned
- Size a bitrate ladder and the playlists that serve it
- Quiz: Media pipelines: transcoding and adaptive bitrate
- Size the bandwidth of a video meeting and its relays
- Quiz: Live streaming, LL-HLS and WebRTC SFUs
Observability, incidents and lessons from outages
- Read a traceparent header and pass the trace on
- Quiz: Logs, metrics and traces: what each answers
- Decide between a page, a ticket and silence
- Quiz: Alerting on SLOs: burn rates and on-call
- Build one timeline from logs with skewed clocks
- Quiz: Incident response and blameless postmortems
- Correct a closed-loop latency log for coordinated omission
- Quiz: Load testing, capacity planning and chaos tests
- A queue that changes its policy under overload
- Quiz: Outages: retry storms and metastable failures
- Fix the DNS automation race with versioned writes
- Quiz: Outages: failover, DNS and hidden dependencies
Security, privacy and compliance
- Find the STRIDE questions a threat list has not answered
- Quiz: Threat modelling a design with STRIDE
- Find the secrets mistakes in a deployment's settings
- Quiz: Encryption, key management and secrets
- Build a layered limit by address, account and device
- Quiz: Abuse, bots and DDoS: defending a public service
- Fix a store that leaks invoices between tenants
- Quiz: Tenant isolation and fine-grained authorisation
- Tag data fields with purpose, retention and consent
- Quiz: Privacy by design and India's DPDP Act
- Write the verifier of a hash-chained audit log
- Quiz: Audit logs, data localisation and compliance
Delivery, multi-region, disaster recovery and cost
- Split users between the variants of a flag by hashing
- Quiz: Safe deployments: canaries, rollbacks and flags
- Accept writes only in a user's home region, and move homes with epochs
- Quiz: Multi-region: active-passive vs active-active
- Restore a base backup and replay the log to a point in time
- Quiz: Backups and disaster recovery: RPO and RTO
- Price two designs per 1,000 requests and pick the cheaper one that meets the SLO
- Quiz: Cost-aware design and unit economics
- Relay an outbox in order, and receive each message once
- Quiz: First-hand case: how MySmartCoPilot is built
Building blocks: traffic, storage and messaging
- Decide when a region is down, by quorum and hold-down
- Quiz: Design a DNS-based global traffic manager
- Fill a Maglev lookup table from the backends' preferences
- Quiz: Design a software load balancer
- Pick the route for a request, by match precedence
- Quiz: Design an API gateway
- Count origin fetches with request collapsing
- Quiz: Design a content delivery network
- Route reads by hash slot and follow MOVED and ASK
- Quiz: Design a distributed cache
- Choose a key's replicas, one per zone
- Quiz: Design a distributed key-value store
- Return one page of a key listing, with a delimiter
- Quiz: Design an S3-like object store
- Find an offset through segments and a sparse index
- Quiz: Design a distributed message queue
- Dispatch messages in order per key, in parallel across keys
- Quiz: Design a pub-sub system with fan-out
- Apply change events to an index with external versions
- Quiz: Design a search service
- Pack and unpack a 64-bit Snowflake-style ID
- Quiz: Design a unique ID generator
Building blocks: control, safety and platform services
- Build a token bucket that takes the time as an argument
- Quiz: Rate-limiting algorithms compared
- Check a key's and a tenant's limits in one step
- Quiz: Design a distributed rate limiter
- Lease runs to workers and refuse a stale completion
- Quiz: Design a distributed job scheduler
- Keep a lock table with sessions, waiters and fencing tokens
- Quiz: Design a lock and coordination service
- Fix the fallback of a configuration client
- Quiz: Design a config and feature-flag service
- Route one notification by category, preferences and quiet hours
- Quiz: Design a notification service
- Size, increment and read a sharded counter
- Quiz: Design sharded counters for likes and views
- Redact emails, tokens and card numbers, but keep order IDs
- Quiz: Design a logging pipeline
- Decode delta-of-delta timestamps from a compressed block
- Quiz: Design a metrics and alerting system
- Assemble traces from spans that arrive shuffled, twice or alone
- Quiz: Design a distributed tracing system
- Reserve tokens up front and settle them when the answer ends
- Quiz: Design an LLM gateway
Recurring problems and the moves that solve them
- Route a read so that users see their own writes
- Quiz: Scaling reads: replicas, caches and precomputation
- Plan the flushes of a size-or-time write batcher
- Quiz: Scaling writes: sharding, batching and logs
- Seat holds that expire and never sell a seat twice
- Quiz: Contention: holds, locks and no double booking
- Decide push or pull for every follow
- Quiz: Fan-out: push, pull and hybrid timelines
- Route a message through the session registry
- Quiz: Real-time connections, presence and routing
- Resume a job from its checkpoint and honour a cancel
- Quiz: Long-running work: jobs, progress and workflows
- Admit the next people from a waiting room, fairly
- Quiz: Traffic spikes: pre-scaling and waiting rooms
- Classify ten differences and decide what to do
- Quiz: Duplicates, drift and reconciliation
Case studies: links, files and media
- Encode and decode base-62 short codes
- Estimate a URL shortener and pick its redirect path
- Quiz: Design a URL shortener with click analytics
- Size a paste store from its expiry choices
- Quiz: Design a paste service like Pastebin
- Size a photo service and pick the path of a post
- Quiz: Design photo sharing like Instagram
- Size ingest, uploads in flight, encoders and storage
- Quiz: Design a video platform like YouTube: uploads
- Size egress, segment requests, origin load and position saves
- Quiz: Design a video platform like YouTube: playback
- Size a live match and trace a cached segment
- Quiz: Design live cricket streaming like JioHotstar
- Size swipes, ranking work, events and egress for a feed
- Quiz: Design a short-video feed like TikTok
- Size streams, egress and storage for music streaming
- Quiz: Design music streaming like Spotify
Case studies: social, feeds and search
- Build one page of a feed from an inbox and pulled timelines
- Quiz: Design a news feed
- Find the newest posts with a term across time segments
- Quiz: Design X (Twitter): timelines and search
- Quiz: Design search autocomplete
- Put URLs in a normal form before the seen check
- Quiz: Design a web crawler
- Write one round of PageRank, with pages that link nowhere
- Quiz: Design a simplified web search engine
- Order a thread best first, to a fixed depth
- Quiz: Design a Q&A forum like Quora or Reddit
- Plan a feed's next poll from its last answer
- Quiz: Design a news aggregator
- Filter and rank a deck in both directions
- Quiz: Design dating matches like Tinder
- Rank trending topics by surprise, with a floor
- Quiz: Design top-K trending topics
Case studies: messaging, real time and collaboration
- Show pushed messages in order and find the gaps
- Quiz: Design a chat app like WhatsApp: delivery
- Decide who gets a sender key before a group message
- Quiz: Design a chat app like WhatsApp: groups and E2EE
- Filter search hits by workspace and channel access
- Quiz: Design team chat like Slack or Discord
- Turn reaction taps into one update a second
- Quiz: Design live comments and reactions
- Choose a simulcast layer for one receiver
- Quiz: Design video calls like Zoom
- Run a server-side chess clock with an increment
- Quiz: Design online chess and multiplayer games
- Transform two concurrent edits so both orders agree
- Quiz: Design a collaborative editor like Google Docs
- Check a typed code with expiry, try limits and a cool-off
- Quiz: Design an OTP and SMS gateway
- Decide DMARC from SPF, DKIM and alignment
- Quiz: Design an email service like Gmail
Case studies: location, mobility and logistics
- Size searches, the index, reviews and bandwidth for nearby search
- Quiz: Design proximity search like Yelp
- Size the matching path and name its components
- Quiz: Design ride hailing like Uber or Ola: matching
- Size trip events, storage, payment calls and pricing cells
- Quiz: Design ride hailing: trips, pricing, payments
- Size orders, rider updates, riders and storage for food delivery
- Quiz: Design food delivery like Swiggy
- Size tile traffic, edge bandwidth, the tile set and the probe stream for a maps service
- Quiz: Design maps, routing and ETA
- Size peak uploads, yearly file and stream storage, and feed map bandwidth
- Quiz: Design activity tracking like Strava: GPS ingestion
- Size efforts, leaderboard writes and the effort log for segment matching
- Quiz: Design activity tracking: segments and leaderboards
Case studies: booking, commerce and contention
- Hold a group of seats all or nothing, then confirm it
- Quiz: Design movie seat booking like BookMyShow
- Promote RAC and waiting passengers after a cancellation
- Quiz: Design a Tatkal-style train booking burst
- Check and take stays in availability bitmaps
- Quiz: Design hotel and home-rental booking
- Make an order safe against repeated, late and old payment events
- Quiz: Design an e-commerce checkout like Flipkart
- Write a stock gate with a limit per account and unit numbers
- Quiz: Design a flash sale system
- Accept bids with increments, a soft close and a hard stop
- Quiz: Design an online auction
- Keep fetches within a site's limits and back off when told
- Quiz: Design a price tracker: collecting prices
- An alert that fires once, ignores repeats and re-arms with a margin
- Quiz: Design a price tracker: history and drop alerts
Case studies: payments, money and markets
- A bank's debit and reversal that are safe to repeat
- Quiz: Design UPI-style payments: flows and idempotency
- Route card payments by each acquirer's last minute
- Quiz: Design an online payment gateway
- An order book that matches by price, then time
- Quiz: Design a stock exchange matching engine
- Apply exchange reports that arrive late, twice or out of order
- Quiz: Design broker order management like Zerodha
Case studies: India's digital public infrastructure
- Size the search fan-out and the evidence store of an open network
- Quiz: Design an open commerce network like ONDC
- Size the people, the connections and the storage of a KYC service
- Quiz: Design an identity verification (KYC) service
- Size a document wallet for an exam result day
- Quiz: Design a document wallet like DigiLocker
- Size an invoice registration portal for the end of the month
- Quiz: Design an e-invoicing network like GST IRP
Case studies: platforms, analytics and developer tools
Interview practice and study plans
- Choose what to practise after a scored round
- Quiz: How design rounds are assessed, level by level
- Quiz: Running a timed self-mock interview
- List the decisions that a changed assumption touches
- Quiz: Follow-ups, curveballs and common mistakes
- Check that a study plan puts every lesson after its prerequisites
- Quiz: Study plans: one week, six weeks, three months
Results here are what this browser has checked: feedback for you, not proof. They stay on this device; your Learn progress can be exported to a file. · Back to the System Design (High-Level Design) track