The whole course ▾
System Design · Week 1 revision
Week 1 revision: Foundations
Week one in ten minutes: four lessons on one board, then six questions to test yourself before tomorrow's mock.
Got a doubt? Ask in the comments under the video.Subscribe
Lesson 1From tap to server
Lesson one: what really happens in the second after you open an app.
You tap QuickBite. First, the phone asks a DNS resolver for the server's address: the internet's phonebook turns a name into an IP. Then it opens a connection to the app server: a TCP handshake to make it reliable, and a TLS handshake to make it private. Only then does the HTTP request go, and the server reads the orders DB to answer.
In the interview, say it in one line: a request is a series of hops. DNS for the address, TCP and TLS for the connection, and HTTP for the data. Every hop costs time, which is why the very first request is always the slowest.
Lesson 2The numbers to know
Lesson two: the numbers that prove a design will work before anyone writes a line of code.
Four speeds to keep in your head. Reading memory takes about a hundred nanoseconds. An SSD read takes about a hundred and fifty microseconds, over a thousand times slower. A round trip inside the same data center is about half a millisecond, and a round trip across the world is about a hundred and fifty milliseconds. Memory is fast, disk is slower, and the network is slowest.
Then the back-of-the-envelope math. A day is about a hundred thousand seconds. So a million orders a day is about ten orders a second. Plan for the peak, around three times the average: thirty a second. And at one kilobyte an order, that's a gigabyte a day, about three hundred and sixty-five gigabytes a year.
In the room, say the numbers out loud: with a million orders a day, we expect ten requests a second, thirty at peak, and about three hundred and sixty-five gigabytes a year. And remember that the slowest one percent of requests, the p ninety-nine, matters more than the average.
Lesson 3The contract
Lesson three: the contract between the app and the server, and how the data is shaped.
The customer app talks to the orders API through a contract. To place an order, it sends POST slash orders. The API saves it in the orders DB and answers two hundred and one, created. Status codes are part of the contract: two hundred means it worked, four hundred means the request was wrong, and five hundred means the server broke.
Three rules from that lesson. Use cursor pagination for long lists, so new orders don't make items repeat or vanish while someone scrolls. Send an idempotency key with every payment, so a retry never charges twice. And pick SQL or NoSQL by the queries you need, not by what's in fashion.
And the line to say: I'll define the API endpoints and the data model first, so we agree on the contract before drawing any boxes.
Lesson 4The 45-minute plan
Lesson four: the plan that turns forty-five minutes of panic into a calm, structured answer.
Four steps, always in this order. Requirements first: what the system must do, and how much traffic it must take. Then the API and the data model. Then the high-level design, the boxes and arrows. And finally the deep dives, on the parts the interviewer cares about most.
Open with this line: I'll start by clarifying requirements and estimating scale, so we don't over-engineer. And when your high-level design is done, don't guess the next step: ask the interviewer which part they want you to go deeper on.
Test yourself
Why is the first request to a new server slower than the ones after it?
Show the answer
It pays for the TCP and TLS handshakes first. Later requests reuse the open connection.
Your internet is fast, but the DNS resolver is slow. What does the user see?
Show the answer
Nothing, at first: the app can't reach the server until it knows the address.
Average traffic is 2,000 requests a second. What should you design for?
Show the answer
About 6,000 a second: peaks run around three times the average.
Which is slower: reading from memory, or from an SSD? By how much?
Show the answer
Disk: an SSD read is over a thousand times slower than memory.
A payment request times out and the app retries. How do you avoid charging twice?
Show the answer
Send an idempotency key: the server sees the same key again and does the work only once.
You've drawn the high-level design. What's your next move?
Show the answer
Ask the interviewer which part to deep-dive into, instead of guessing.
Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.