Start here · Intro

What is system design?

What system design is, the building blocks every design uses, the numbers worth memorising, how a system design interview runs, and how this course is organised.

BeginnerInterview priority: High35 min
On this page
  1. The problem: the app that worked on your laptop
  2. The idea: decide the big pieces before the small ones
  3. How it works: the building blocks
  4. Options and trade-offs: how much design is enough?
  5. When not to design for scale
  6. How a system design interview works
  7. How this course is organised
  8. Quiz

The problem: the app that worked on your laptop

You build a lunch-ordering app. On your laptop it is perfect: the menu loads instantly, orders go through, the demo impresses everyone. You put it on one rented server with the database on the same machine and launch it at a big office park.

At 12:30 on day one, ten thousand people open it at once. Pages take eight seconds to load, then start failing. The server's processor is pinned at 100%, and the database, sharing the same machine, is fighting it for memory and disk. One customer is charged twice because the page timed out and they pressed "Pay" again. At 12:41 the server runs out of memory and restarts, and for two minutes nobody can order at all.

One server, ten thousand people at lunchtime

  1. One person ordering lunch is easy for one server. Now imagine ten thousand people opening the app at lunchtime: the server’s load climbs past what it can handle, and requests start failing.

Nothing in the code was "wrong". Every line did what it was meant to do. What was missing was a design: a decision about which machines exist, what each one does, how they talk, and what happens when there are too many users or one of the parts breaks. That is what this course teaches.

The idea: decide the big pieces before the small ones

System design is choosing the parts of a software system and how they fit together so that it meets its goals: fast enough, reliable enough and cheap enough, for the number of people who will actually use it. It is the level above code. A code review asks "is this function right?"; a design review asks "what happens when this database is down?"

Every design starts from the same tiny loop, so learn its vocabulary first.

A request goes out, a response comes back

  1. Every time you open an app, say to order lunch, your phone sends a small message across the internet to a computer you will never see.
  2. That message is called a request. The computer that answers it is a server, and the answer it sends back is the response.
  • A client is the program the person uses: a phone app or a web browser.
  • A request is the message the client sends ("show me the menu"), usually over HTTP, the language of the web.
  • A server is a computer, usually in a data centre, running your code. It receives requests and sends back a response.

The server rarely knows the answer by itself. It asks a database, the program that stores data safely on disk so it survives restarts. Each of those hops takes time, and the total is the latency: how long the person waits.

The server asks the database, and every hop adds to the wait

  1. The server rarely knows the answer on its own. It asks a database, the place where all the data lives: users, menus and orders.
  2. Every hop takes time. Add them up and you get latency: how long the person waits. Here it is about a tenth of a second, which feels instant.

The four goals, and why they fight

Fast, reliable and affordable, at any scale

  1. System design is choosing what to build so the app stays fast, keeps working when parts break, and does not cost a fortune, even as more and more people use it.
GoalMeasured asTypical target
Fast (low latency)How long a request takes, especially the slow onesMost requests under 200–300 ms
Reliable (available, durable)Share of time it works; data never lost99.9% ("three nines") is about 8.8 hours of downtime a year
AffordableMoney per month, and engineers' timeGrows slower than the number of users
ScalableHow much more load it takes before redesign10× growth without starting over

They pull against each other. Keeping three copies of the data makes it reliable but costs three times the storage. Waiting for all three copies to confirm a write keeps them identical but makes every write slower. A cache makes reads fast but means some readers see slightly old data. System design is mostly the art of choosing which side of each trade-off you are on, for this product, and saying why.

How it works: the building blocks

Almost every large system, from WhatsApp to Netflix, is built from the same dozen parts. You will meet each in its own lesson.

Building blockWhat it doesLesson
DNSTurns a name like example.com into a server's addresscovered with CDNs
Load balancerSpreads requests across many identical serversScaling
App serversRun your code; ideally keep no data of their ownScaling
CacheKeeps popular answers in memory, close byCaching
CDNCopies of static files in cities near usersCDNs
DatabaseThe durable record of users, orders, messagesSQL vs NoSQL, indexes
Replicas and shardsMore copies of the data, or the data split across machinesReplication, sharding
Message queueLets slow work happen later, without the user waitingMessage queues
Object storageCheap, huge storage for photos, videos and filesObject storage

How a design grows

Designs are not drawn complete on day one. They grow, one bottleneck at a time. A bottleneck is the single part that limits the whole system, like the narrowest point of a funnel. This growth path is also the order of the first part of the course:

  1. One server runs the code and the database. Fine for a prototype.
  2. Separate the database onto its own machine, so code and data stop fighting for memory.
  3. Several app servers behind a load balancer. More capacity, and one server dying no longer takes the site down.
  4. A cache and a CDN take repeated reads off the database and serve images from near the user.
  5. Read replicas, copies of the database that answer reads, when reads still overwhelm one machine.
  6. Queues for slow work (emails, image resizing), and sharding, splitting the data across machines, when writes or data size outgrow one database.

Each step adds capacity and adds something new to run, monitor and keep consistent. You take the next step when the numbers say you need it, not before.

Worked example: does the lunch app need any of this?

Back-of-the-envelope maths (rough estimates, done in a minute) tells you which step you are at. Use 1 day ≈ 86,400 seconds, or about 100 K for quick sums.

Say the lunch app grows to 1 million daily users, each making about 20 requests a day (menu, photos, basket, checkout), and 30% of users order once.

  • Requests: 1 M × 20 = 20 M a day ÷ ~86,400 s ≈ 230 per second on average.
  • Lunch is spiky: assume the peak is 5× the average, so plan for about 1,200 requests per second.
  • Orders (the writes that matter): 300 K a day ≈ 3.5 per second, maybe 20 per second at peak. A single well-tuned Postgres or MySQL primary handles thousands of simple writes per second, so the database is nowhere near its write limit.
  • Storage: 300 K orders × ~1 KB ≈ 300 MB a day, about 110 GB a year. Fits comfortably on one database server.
  • Menu photos: if each page view loads 10 photos of 100 KB, the photos are the biggest traffic by far. They belong in object storage behind a CDN, not on the app servers.

Conclusion: this app needs steps 1 to 4 (a separate database, a few app servers behind a load balancer, a cache for menus and a CDN for photos) and a replica for safety. It does not need sharding or a fleet of microservices. Being able to show that with numbers is the skill.

Go deeper: the numbers worth knowing by heart
OperationRough time
Read from memory (RAM)~100 ns
Read from an in-process cachemicroseconds
Read from Redis in the same data centre0.2–0.5 ms
Round trip inside one data centre~0.5 ms
Indexed database read1–5 ms (10–50 ms under load or from disk)
SSD random read~0.1 ms
Hard disk seek~10 ms
Round trip across a continent or ocean100–150 ms

The lesson in this table: memory is fast, disks are slower, and distance is slowest of all. A request that crosses the Atlantic four times has spent half a second before your code does anything.

Your turn: size a homework app

A homework app has 500,000 students. Each opens it 10 times a day, and each visit makes 15 requests. 20% of all daily traffic arrives in one hour, 7 pm to 8 pm. Each student uploads 2 photos of their work a day, 1 MB each. Work out the average and peak requests per second, the photo storage per day, and which building blocks you would use.

Compare with our answer
  • Requests per day: 500 K × 10 × 15 = 75 M. Average: 75 M ÷ 86,400 ≈ 870 per second.
  • Peak hour: 20% × 75 M = 15 M requests in 3,600 s ≈ 4,200 per second, about 5× the average. Size for the peak, not the average.
  • Photos: 500 K × 2 × 1 MB = 1 TB a day, about 365 TB a year. That goes to object storage, uploaded directly from the phone, and served through a CDN.
  • Photo records in the database: 1 M rows a day ≈ 12 writes per second on average. One database primary handles this easily, with a replica for failover.
  • App servers: if one server handles roughly 500–1,000 requests per second for this kind of work, the peak needs 5–9; run a few more for headroom, behind a load balancer.

A strong answer mentions: requests per second from daily totals · a separate peak figure · photos kept out of the database and app servers · storage per day and per year · the database load is small · server count with headroom.

Options and trade-offs: how much design is enough?

The right design depends on the scale you have, and the scale you will have within a year or so. Here are the stages side by side.

StageGood atWeak atUse when
One server, database includedCheapest, simplest, fastest to buildAny failure is a full outage; code and data compete for resourcesPrototypes, internal tools, a few hundred users
App servers + load balancer + one databaseSurvives an app server failure; app tier scales by adding machinesThe database is a single point of failure and the next bottleneckMost products, up to many thousands of requests per second
Plus cache, CDN, read replicasAbsorbs read-heavy traffic; fast for distant usersStale data, cache invalidation, replica lag to reason aboutRead-heavy apps (10:1 reads to writes or more)
Plus queues, sharding, many servicesVery large write volumes and data sizes; teams work independentlyMuch more to operate; cross-shard queries and distributed failuresOnly when the numbers prove one database cannot cope

A single point of failure is a part that, if it breaks, takes the whole system down. Removing them, one by one, is a big part of every design.

When not to design for scale

  • You don't have the users yet. A single Postgres server with a replica runs a surprising number of successful companies. Sharding a database with 50 GB of data buys complexity and nothing else.
  • The team is small. Ten microservices for a team of three means more time on deployment and debugging than on the product.
  • The requirement is not real. "Five nines" (about 5 minutes of downtime a year) for an internal dashboard costs a fortune and nobody needs it.

Good designers start simple and know exactly which part will break first, and what they will do when it does.

How a system design interview works

Most software interviews beyond junior level include one or two design rounds. You get a vague prompt ("Design WhatsApp", "Design a URL shortener"), a whiteboard or drawing tool, and 45–60 minutes. There is no single right answer. The interviewer is watching how you think: whether you ask the right questions, use numbers, make sensible trade-offs and explain them clearly.

A strong answer follows the same recipe every time (practised step by step in the design interview recipe):

StepTimeWhat you do
1. Requirements~5 minAsk what it must do, for how many users, how fast; say what is out of scope
2. Estimates~5 minRequests per second, storage, bandwidth, peak vs average
3. API~5 minThe few calls the client makes
4. Data model~5 minThe main tables or records and which database
5. High-level design~10 minBoxes and arrows; trace one request through them
6. Deep dives10–15 minThe 2–3 hardest problems: options, a choice, how it fails
7. Wrap-up2–3 minBottlenecks, failures, what you would monitor

There are three related kinds of round, and this site has a track for each:

  • System design (high-level design): the boxes and arrows, as above. The concept lessons teach the building blocks.
  • Low-level design (machine coding): the classes and code inside one service, such as a parking lot or a vending machine. See what is low-level design?.
  • Case studies: full designs of real products, such as Design WhatsApp, worked through in interview order.
Your turn: spot the problem

A candidate is asked to "design a food delivery app". Their first sentence is: "I'll use microservices on Kubernetes, Kafka between every service, Cassandra for all the data and GraphQL for the API." What is wrong with this start, and what should they have done instead?

Compare with our answer
  • They picked technologies before any requirements: they don't know the scale, the features or the latency targets yet.
  • There are no numbers, so nobody can tell whether any of this is needed. A city-sized app might run on one database.
  • Cassandra for everything is a poor fit for orders and payments, which need transactions across rows (all-or-nothing updates); a relational database suits them better.
  • No trade-offs: every choice has a cost (Kafka and Kubernetes are a lot to operate), and none was mentioned.
  • A better start: ask about users, cities, peak order rate and real-time tracking; estimate; then draw the simplest design that works and trace one order through it.

A strong answer mentions: requirements first · estimates to justify complexity · a database chosen by data and access pattern · a cost for every choice · start simple and trace a request.

How this course is organised

Each lesson follows the same shape: a real problem, the idea in plain words, how it works with figures you can step through, the trade-offs, where it breaks, what to say in an interview, Your turn boxes to practise on, a one-page cheat sheet and a quiz. Beginners can stop after the core sections; the boxes marked "go deeper" are for interview preparation.

Every chapter also has an interactive version

  1. Each chapter works the same way. Watch a short animation, see the same idea as a story in Byte City, build it yourself in a playground, then check yourself with a quiz.

Every lesson also has an interactive version in the Byte City app: a short animation, a story set in the city, a playground where you build the idea yourself, and a quiz.

System design on one page
  • System design = choosing the parts of a system and how they connect so it is fast, reliable and affordable at the scale it will really have.
  • The loop: client → request → server → database → response. Latency is the sum of every hop.
  • Building blocks: DNS, load balancer, stateless app servers, cache, CDN, database (+ replicas, shards), queue, object storage.
  • Growth path: one server → separate database → load balancer + several servers → cache + CDN → replicas → queues and sharding. Take each step when the numbers demand it.
  • Estimates: daily total ÷ ~86,400 = average per second; plan for a peak of 2–5× (or more for spiky traffic).
  • Know the numbers: memory ~100 ns, Redis ~0.5 ms, database read 1–5 ms, cross-ocean round trip 100–150 ms.
  • Availabilities multiply along a chain of dependencies; redundancy and graceful degradation fix it.
  • Interview recipe: requirements → estimates → API → data model → high-level design → deep dives → wrap-up. Clarify first, use numbers, name trade-offs.
Interactive labPractise it: time a request's journey and make it fastOpens in the ByteAtlas lab. Your progress is saved in this browser.
Check what stuck

1. An interviewer says "Design a URL shortener" and stops talking. What is the best first move?

2. An app has 2 million daily users, each making about 10 requests a day. Roughly how many requests per second is that on average?

3. Every request passes through a load balancer (99.99% available), the app servers (99.9%) and a database (99.9%). About how available is the whole path?

4. Your app servers are stateless and mostly idle, but the database is at 95% CPU, nearly all from repeated reads of the same product pages. What helps first?

5. A user in Sydney opens a page whose browser makes four API calls one after another to servers in Virginia, each a 150 ms round trip. The server needs 10 ms per call. What dominates the wait?

6. A startup with 5,000 users and a 20 GB database asks for a review. The proposal shards the database across 16 machines "to be ready for growth". What is the best critique?

7. What does a system design interviewer mostly assess?

Score 60% or more and the lesson is marked complete.

Passing the quiz also marks it complete. Progress is saved in this browser only.