Courses

System design

Learn to answer any "design X" interview question by building the system and explaining each choice.

Continue Lesson 1 Continue Fourteen quick questions show where you start, then you build. No sign-up needed. You stopped at goal 1 of 4. Start over Lesson 1 cleared.

Not sure you know the basics? Find out in fourteen questions.

0 of 24 parts real3 of 24 parts real

Each level is a harder kind of problem, so topics you've met come back tougher.

  1. Safety briefing

    OptionalPlanned

    Stuck on a word like DNS or API? Short explainers, whenever you need them.

    Show 14 topics
    1. How the web finds a site (DNS)
    2. Addresses and connections
    3. TCP or UDP: whole or on time
    4. What a browser and a server say to each other (HTTP)
    5. Cookies: how a site remembers you
    6. Client and server: never trust the client
    7. APIs: change one without breaking another
    8. Databases and indexes
    9. What a server is made of
    10. Busy servers and waiting lines
    11. How long each step takes
    12. Measuring speed, load and errors
    13. Alerts and uptime
    14. Trace one request through one server
  2. More than one server

    New gradLesson 1 open

    You can keep one app running through a busy day.

    Interview prep: the basics every answer is built on.

    Gate: blog launch day

    Scored on cost, speed and errors.

    Traffic
    2,000 visitors/s
    Lasts
    10 min
    Budget
    About 4 servers
    Slowest pages
    Under 300 ms
    Errors
    Under 0.1%
  3. Viral

    Mid-levelPlanned

    You can handle a sudden crowd and size a system before building it.

    Interview prep: where design interviews begin.

    Final test: a link shortener with 100M new links a month.

    Show 11 areas
    • Ask before you buildTurn a vague question into features, numbers, an API and data.
    • Back-of-envelope mathsEstimate traffic and storage before you build.
    • Files close to usersServe files and pages from close to each visitor.
    • Read copiesSpread reads and handle data that lags behind.
    • A copy far awayPut a read copy in another region for faraway users.
    • Cache under a crowdBack from L3Survive millions of people wanting the same item.
    • Rate limiterSlow down abusers without hurting everyone else.
    • Unique IDsMake IDs on many machines that never clash.
    • Timeouts and retriesGive up on slow calls and try again without piling on.
    • Your first queueMove slow work out of the request.
    • Locks on the doorsStore passwords, sign people in and keep secrets safe.

    Gate: link shortener

    Scored on cost, speed and errors.

    New links
    100M a month
    Reads
    10 per write
    Redirects
    Under 50 ms worldwide
    Uptime
    99.9%
    Budget
    Fixed monthly
  4. Too big for one machine

    SeniorPlanned

    You can design a whole product on your own.

    Interview prep: the main interview target.

    Final test: a chat app for 50M people a day.

    Show 16 areas
    • ShardingSplit data across machines and pick the right key.
    • Consistent hashingAdd a machine without moving everything.
    • Splitting the app into servicesSplit off services only where it pays.
    • Queues and workersBack from L4Handle crashes, floods and bad jobs in a queue.
    • Event logs and streamsLet many readers replay the same events.
    • Safe retriesBack from L4Repeat a request without doing the work twice.
    • Live connectionsKeep millions of WebSockets open.
    • Fan-outDecide between push and pull for a feed.
    • SearchFind words in millions of posts, and suggest as people type.
    • LocationFind what is nearby and match riders to drivers.
    • Media pipelineUpload, convert and stream video.
    • Caches that stay correctBack from L4Update many caches when the data changes.
    • A backup regionBack from L4Keep a second region ready to take over.
    • How databases store dataBack from L3Pick how each kind of data is stored.
    • Many people, one thingSell the last seat once, even to a crowd.
    • MonitoringSpot trouble in the graphs while it's still small.

    Gate: chat app

    Scored on cost, speed and errors.

    Users
    50M a day
    Messages
    Under 200 ms
    Order
    Always kept
    Offline users
    Get everything on return
    Main region
    Fails once
  5. Things break

    StaffPlanned

    You can keep a system correct while parts of it fail, and defend the tradeoffs.

    Interview prep: staff-level tradeoff questions.

    Final test: payments that survive a network split.

    Show 17 areas
    • What "correct" meansSay exactly what each user sees after a write.
    • Copies and quorumsDecide how many machines must agree.
    • Network splitsChoose what stays up when machines can't talk.
    • Time and orderPut events in order without trusting clocks.
    • Leaders and consensusElect one leader, and never two.
    • Data across servicesKeep data right across services without one big transaction.
    • Two regions that both writeBack from L5Decide who wins when regions disagree.
    • Stop one failure from spreadingKeep one slow part from taking down the rest.
    • The slowest 1%Keep the slowest requests fast.
    • Hot shardsBack from L5Split a busy shard while it keeps serving.
    • Queues that fall behindBack from L5Slow the senders before the backlog sinks you.
    • Streams with timeCount events per minute, even when they arrive late.
    • Big-file storageStore huge files safely and cheaply.
    • Error budgetsBack from L5Use failure numbers to decide when to stop shipping.
    • Failure drillsPractise failures before they happen, and lead the response when one does.
    • Keep it simpleWrite the design doc, choose build or buy, and cut parts.
    • Money done rightKeep the books exact, down to the cent.

    Gate: payments

    Scored on cost, speed and errors.

    Machines
    One dies every hour
    Network
    Splits mid-run
    Regions
    Two, both take payments
    Payments lost
    Zero
    Double charges
    Zero
  6. Planet scale

    Senior staffPlanned

    You can run a system worldwide and weigh cost, law and change.

    Interview prep: senior staff questions on cost, law and change.

    Final test: a worldwide ticket sale for 10M people.

    Show 10 areas
    • Worldwide trafficBack from L6Serve every user from the right region.
    • Cells and blast radiusLimit how many users one failure can reach.
    • Losing a region at peakBack from L5Move a whole region's users without losing data.
    • Capacity planning and launchesBack from L4Plan and load-test a launch before it happens.
    • Data rules by countryKeep each country's data where the law says.
    • Cutting costSpend less without breaking your limits.
    • Zero-downtime migrationBack from L4Change a live system while people use it.
    • A platform for many teamsLet many teams build on one system safely.
    • Abuse at scaleBack from L4Keep bots and fraud out of a big sale.
    • Built to lastPlan years of work in steps that each ship.

    Capstone: worldwide ticket sale

    Free

    Pass it for the trophy.

    Crowd
    10M in 5 min
    Halfway
    A region goes dark
    Budget
    Cut by 30%