🧭 System Design L6

Learn system design through realistic production scenarios. Trace requests, compare tradeoffs, recover from failures and validate every design.

42 lessons · about 6 hours

Start the first lesson →

Start Here: Learn the STAR Method

Define the situation and task, explain your actions, then validate the result.

  1. 01The L6 System-Design Thinking Loop A simple routine for any design question: say what must never break, size the busiest moment, plan for things going wrong, and show how you'd prove it works.Advanced8 min read
  2. 12System Design Interview Framework A simple seven-step path that turns a vague question like 'design a chat app' into a clear design, with reasons for every choice.Advanced8 min read
  3. 39L6 Production Debugging Casebook Ten real-world style production problems: gather the clues, find the true cause, and make the system safer.Advanced13 min read

Core Concepts Through Worked Scenarios

Connect capacity, caching, networking and data choices to concrete user requirements.

  1. 07Capacity, Availability, Latency and CAP The basic limits behind every design: how much traffic you get, how fast you answer, how often you're up, and what you do when parts of your system can't talk to each other.Advanced7 min read
  2. 33Capacity Planning, SLOs and Error Budgets Turn fuzzy goals like 'it must be fast and reliable at scale' into clear numbers: how much traffic to plan for, how fast and reliable to be, how much failure is allowed, and what to do when you run out.Advanced9 min read
  3. 08Caching, Consistent Hashing and Sharding Keep fast copies of popular data close to users, spread data across many machines in a stable way, and understand what can go stale when you do.Advanced8 min read
  4. 10Proxies, APIs and Real-Time Protocols Different conversations need different ways to talk. Pick REST, RPC, queues, long polling, WebSockets, TCP or UDP by asking what the user is actually doing.Advanced7 min read
  5. 11Batch vs Stream and Data Modeling Decide when work runs (later in a batch, or right away in a stream) and store data correctly first. Only make copies for speed once you've proven reads are slow.Advanced7 min read
  6. 23Networking, DNS and Traffic Routing Follow one request from the user's browser to your server: how DNS finds you, how load balancers and proxies pick a healthy server, and why switching away from a broken region is never instant.Advanced8 min read
  7. 24API Contracts, Gateways and Security Write down clearly what your API accepts and returns, change it without breaking old apps, and check on every request that the caller is allowed to touch that exact thing.Advanced8 min read
  8. 25Real-Time, Pub/Sub, Webhooks and CDC Pick the right way to push updates (to browsers, to partner servers, to other services), and make sure every event can be tracked, safely repeated and replayed.Advanced8 min read
  9. 26Database Internals, Replication and Scaling Understand what's happening inside your database (how it stores data, copies it, and hands out connections) so you can fix slowness with the right tool instead of just adding servers.Advanced8 min read
  10. 4010,000 Users Do Not Need 10,000 Database Connections Why a few busy database connections can serve thousands of users, how to size a connection pool, and what to check before you make it bigger.Advanced10 min read
  11. 38Storage, Search and Location Queries Use the right tool for each job (object storage for files, a search index for text, a geo index for 'near me') while one main database stays the final word on what's real.Advanced8 min read

Reliability: Failure and Recovery

Walk through retries, overload, coordination and regional failures without losing correctness.

  1. 02Payment Retries: Prevent Duplicate Charges When a payment request is retried, the customer must never be charged twice. Save the attempt first, reuse one ID for every retry, and look up unclear results instead of guessing.Advanced8 min read
  2. 03Timeouts, Retries & Backpressure When something you depend on gets slow, stop waiting forever, don't pile on retries, and say 'not now' before you drown.Advanced7 min read
  3. 34Resilient Service Calls: Retries, Breakers and Load Shedding When one service you call gets sick, keep it from dragging your whole system down with it.Advanced8 min read
  4. 06Debug Latency Like an Investigator Slow requests don't always mean busy CPUs. Find where the time is actually spent, often waiting in a line, before you add more servers.Advanced7 min read
  5. 35Observability and Incident Response Use metrics, traces and logs together to find out what is really broken in production, fix it, and prove it's fixed.Advanced7 min read
  6. 09Distributed Coordination: Consensus, Heartbeats and Gossip Computers that work together must agree on who is in charge, notice who has died and spot broken data. Use the right tool for each job, and never trust an old boss who wakes up late.Advanced8 min read
  7. 27Time, Consistency and Distributed Transactions Computer clocks disagree and workers pause, so don't trust timestamps to decide who wins. Use version numbers, fencing tokens and step-by-step workflows (sagas) instead.Advanced10 min read
  8. 28Data Structures for Scale Clever structures that answer huge questions fast (what's near me, have I seen this before, how many unique visitors) by accepting a small, known error.Advanced8 min read
  9. 36Message Delivery: Queues, Kafka, Ordering and DLQs Pick the right kind of message system, and plan up front for duplicate messages, ordering, broken messages and replays.Advanced8 min read
  10. 37Multi-Region and Disaster Recovery Decide what must survive losing a whole region, how much data you can afford to lose, and how to prove you can really recover.Advanced7 min read
  11. 42A WhatsApp OTP Is Only Single Use If You Make It So Make a one-time code really work only once, even when two requests arrive in the same second: store a hash, check and mark it used in one step, limit wrong guesses, handle crashes, and test the race.Advanced15 min read

Architecture and Operations

Use measurable outcomes to choose boundaries, analytical pipelines and safe releases.

  1. 19Architecture Patterns at Scale Pick between one big app, many small services, serverless functions, events or peer-to-peer based on who owns what, what should fail alone, and how much running cost your team can handle.Advanced7 min read
  2. 29Big Data: ETL, Warehouses and Streaming Turn millions of raw events into reports people can trust: keep the raw data, clean it in clear stages, say how fresh each report is, and be able to rebuild when something goes wrong.Advanced7 min read
  3. 30Releases, Observability and Production Safety Ship changes to a few users first, watch real customer outcomes, keep old and new code compatible with the database, and always have a way to turn the change off.Advanced7 min read

STAR Case Studies

Follow a user scenario from requirements through normal requests, failures, recovery and validation.

  1. 04Flash Sale: 10 Million Buyers, No Oversell A waiting line calms the crowd, but it doesn't hold any stock. Only the real inventory database decides, in one all-or-nothing step, who gets each item.Advanced7 min read
  2. 05Premiere-Night Video Streaming Let millions press Play at once by keeping the small 'can I watch?' checks separate from the huge video data, which is served from copies close to viewers.Advanced8 min read
  3. 13Design a URL Shortener Turn long links into short ones that never get lost, redirect in milliseconds, can be switched off fast if harmful, and count clicks without slowing anyone down.Advanced8 min read
  4. 14Design a Chat Application Deliver messages live without ever losing them. Keep 'saving the message' separate from 'sending it out', 'who's online' and 'notifying offline phones'.Advanced7 min read
  5. 15Design a Ride-Sharing Service Find nearby drivers with a map index, then lock one driver to one ride safely. Treat driver locations as fast, rough hints, and ride assignments as firm promises.Advanced8 min read
  6. 16Design a File Storage Service Let big files go straight to cheap file storage, while your own server keeps track of who owns each file, who can see it, and when it is safe to download.Advanced7 min read
  7. 17Design a Polite Web Crawler Visit huge numbers of web pages without going in circles or flooding any one website: clean up URLs, skip repeats, and keep a separate line for each site.Advanced7 min read
  8. 18Design a Reliable Notification System Send email, SMS, push and in-app messages that respect user choices, keep urgent messages fast, avoid sending twice, survive a provider outage and leave a clear record of what happened.Advanced7 min read
  9. 20Design a Social Media Feed Build a fast home feed: save each post once, copy it into followers' feeds for normal accounts, fetch it live for celebrities, accept small delays and never leak private posts.Advanced7 min read
  10. 21Design an E-Commerce Checkout Let browsing be fast and loose, but make the checkout path exact: hold the stock, charge once even on retries, create the order and announce it reliably.Advanced7 min read
  11. 22Design a Logging and Monitoring Platform Collect huge amounts of logs and metrics without losing the important ones, keep recent data fast to search and old data cheap to store, and send alerts people actually trust.Advanced7 min read
  12. 31Collaborative Document Editing & Real-Time Sync Build something like Google Docs: many people type in the same document, some offline, and everyone ends up with the same text, no saved edit is ever lost, and live cursors stay light and temporary.Advanced19 min read
  13. 32The Hot SKU Alert Problem One product's price drops and ten million people are watching it. Tell every one of them exactly once, without freezing the price update, overloading the email provider or delaying urgent messages.Advanced13 min read
  14. 41500 Users Upload Documents at Once: Design the Background Job Pipeline Take slow document processing out of the upload request: save the file, write down a job, put it in a queue, and let workers do the heavy work safely, with retries, no duplicates, and a clear 'we're full' when overloaded.Advanced17 min read