System designCrash course7 min read

The Fundamentals First: Networking, APIs and Estimation

System design interviews assume a working knowledge of how machines talk to each other and how big things are. You will not be asked to recite the TCP handshake, but you will be asked to pick a protocol for a feature and to size a system before you design it. This lesson is for engineers who have built web apps but have not had to reason about them at scale. It covers the networking you need, how to choose between REST, gRPC, WebSockets and long polling, the latency numbers worth carrying in your head, and back-of-the-envelope estimation with a full worked example.

Why the interviewer cares

Two scored areas lean on this material. Requirements: a strong candidate turns "a lot of users" into requests per second and terabytes, because those numbers decide whether you need a cache, replicas or shards. Trade-offs: choosing WebSockets for a chat app is only convincing when you can say why polling would not do. Getting the fundamentals right is what lets the rest of your design sound deliberate rather than memorized.

HTTP and what its methods promise

Most system design APIs are HTTP. The parts that matter in an interview are the semantics of the methods and status codes, because they decide what clients and proxies are allowed to do.

  • GET reads and must not change state, which is why caches and CDNs may store and replay its responses.

  • PUT and DELETE are idempotent: sending the same request twice leaves the same end state, so a client can retry them after a timeout.

  • POST is not idempotent by default. Retrying "create order" might create two orders, which is why payment APIs accept an idempotency key with the request.

  • Status codes carry intent: 200 and 201 succeed, 400 and 404 are the client's fault and should not be retried, 429 means slow down, 503 means try again later.

In an interview, when you write an endpoint like POST /orders, say whether it is safe to retry and how. That one sentence shows you have thought about failure.

TCP vs UDP

TCP gives you a reliable, ordered byte stream: lost packets are resent and data arrives in order. The price is a handshake to set up the connection and head-of-line blocking, where one lost packet stalls everything behind it. HTTP/1.1 and HTTP/2 run over TCP, and so do almost all database and service-to-service connections.

UDP sends independent packets with no delivery or ordering guarantees and no connection setup. It suits traffic where a late packet is worthless, such as live voice and video, multiplayer game state and DNS lookups. HTTP/3 runs over QUIC, which is built on UDP and adds its own reliability per stream to avoid TCP's head-of-line blocking.

The interview rule of thumb: default to TCP; reach for UDP only for real-time media or when you can tolerate loss and need the lowest latency.

Choosing how clients and services talk

REST over HTTP

Resources at URLs, standard methods, JSON bodies. It is easy to read, works from any client, and plays well with caches. Use it for public APIs and most request-response features. Its weakness is chattiness: a screen that needs five resources may need five calls.

gRPC

Typed contracts defined in Protocol Buffers, compact binary encoding, HTTP/2 underneath, with streaming in both directions. It is a strong choice for internal service-to-service calls where you control both sides and care about latency and schema safety. Browsers cannot call it directly without a proxy, so it is rarely the public API.

WebSockets

A single long-lived, two-way connection: after an HTTP upgrade, either side can send messages at any time. Use it when the server must push frequent updates with low latency, as in chat, collaborative editing or live dashboards. The cost is state: each connection is held open on a specific server, so you need to track which server holds which user, and plan for reconnects when a server restarts.

Long polling and server-sent events

With long polling, the client makes a request the server holds open until there is news or a timeout, then the client immediately asks again. It works through any proxy and needs no special protocol, which makes it a reasonable fallback, but each update costs a full request. Server-sent events keep one HTTP response open and stream events from server to client; they are simpler than WebSockets when pushes only flow one way, such as notifications or a live score.

A strong answer names the access pattern first ("messages must reach the recipient within a second, and both sides send"), then picks the transport.

Latency numbers worth knowing

Exact figures depend on hardware, so learn orders of magnitude. These are approximate:

  • Reading from main memory: around 100 nanoseconds.

  • Reading 1 MB sequentially from memory: a few to tens of microseconds.

  • A random read from an SSD: around 100 microseconds.

  • A round trip within one data center: roughly half a millisecond.

  • Reading 1 MB sequentially from an SSD: around 1 millisecond.

  • A disk seek on a spinning hard drive: around 10 milliseconds.

  • A round trip between continents: roughly 100 to 150 milliseconds.

What follows from them matters more than the numbers. Memory is about a thousand times faster than an SSD random read, which is why caches pay off. A cross-region round trip costs more than hundreds of in-data-center calls, which is why synchronous replication across continents makes every write slow. If a page makes ten sequential calls between continents, it cannot load in under a second.

Back-of-the-envelope estimation

Estimation is not about precision. It is about learning which resource will run out first, so you design for that. Round aggressively, state every assumption out loud, and keep the units visible. Two shortcuts make the arithmetic easy: a day has about 86,400 seconds, so round it to 100,000 (10^5); and 1 million requests per day is therefore about 10 requests per second.

Worked example: a photo sharing app

Assumptions, stated to the interviewer first:

  • 10 million daily active users.

  • Each user views 50 photos a day and uploads 2 photos a week.

  • An average stored photo, after compression, is 500 KB.

  • Peak traffic is 3 times the daily average.

  • We keep photos for at least 5 years.

Reads:

10,000,000 users x 50 views = 500,000,000 views per day
500,000,000 / 100,000 seconds = 5,000 reads per second on average
5,000 x 3 = 15,000 reads per second at peak

Writes:

10,000,000 users x 2 uploads / 7 days = about 2,860,000 uploads per day
2,860,000 / 100,000 seconds = about 29 uploads per second on average
29 x 3 = about 86 uploads per second at peak

Storage over 5 years:

2,860,000 uploads per day x 500 KB = 1,430,000,000 KB = about 1.43 TB per day
1.43 TB x 365 = about 520 TB per year
520 TB x 5 = about 2.6 PB over 5 years

Read bandwidth at peak:

15,000 reads per second x 500 KB = 7,500,000 KB/s = 7.5 GB/s

Check the read-to-write ratio as a sanity test: 5,000 reads to 29 writes is about 170 to 1.

What the numbers tell you

This is where estimation earns its points. The write rate is tiny, so a single database can easily handle the metadata writes. The 2.6 PB of photos cannot live in a database; they belong in object storage. 7.5 GB per second of image traffic at peak is far too much to serve from app servers, so a CDN is not optional. And a 170 to 1 read ratio says reads deserve the engineering effort: caching photo metadata and serving bytes from the edge. Four numbers, and the shape of the design is already decided.

Tip

Say the conclusion with the number: "about 15,000 reads per second at peak, so one database would struggle; I'll put a cache in front." The number is only useful once it changes a decision.

Mistakes that cost points

  • Skipping estimation entirely. Without numbers, every later choice sounds like a guess. Spend three to five minutes on it.

  • Over-precise arithmetic. Multiplying 86,400 by hand eats time and invites errors; rounding to 100,000 is accepted everywhere.

  • Picking WebSockets by habit. If updates are rare or flow one way, polling or server-sent events are simpler, and saying why shows judgment.

  • Forgetting retries. Any network call can time out. State which endpoints are safe to retry and how you make unsafe ones safe.

Practice it

Drill: estimate reads per second, writes per second, five-year storage and peak bandwidth for a video platform where 5 million daily users each watch 20 minutes of video at 1 MB per second. Then read the core building blocks and see which of them your numbers call for.

For a full interview, try Design a URL Shortener, where estimation decides the size of the key space, or Design a Real-Time Chat System, where the transport choice matters.

Practise this in a mock interview

Try what this lesson covers out loud: the AI interviewer asks one of these questions, follows up, and scores your answer.

Read next