Meet the building blocks: a map of a typical web system

Most large web systems are built from the same dozen parts, connected in a familiar shape: clients, DNS, a CDN, load balancers, app servers, caches, databases, queues, workers and object storage.

Why it matters

System design questions use many technical words at once. If you don't know what each part does, answers sound like a list of jargon. Learning the map first makes every later lesson easier, because each one is a closer look at one box on this map.

The idea

A user's app (the client) sends a request over the internet. DNS finds your servers' address, a CDN serves files like photos from somewhere nearby, and a load balancer spreads the other requests across many identical app servers.

App servers run your code: they read quick copies of data from a cache and the real data from a database. Slow jobs go onto a queue for background workers, and big files live in object storage.

A big restaurant chain. The phone book tells you where the nearest branch is (DNS). A host at the door sends you to a free waiter (load balancer). Waiters take orders and serve them (app servers). The pantry holds everything (database), but cooks keep the most-used ingredients on the counter (cache). Washing up happens in the back without making customers wait (queue and workers). The cold store holds big, bulky stock (object storage), and takeaway hatches around town hand out popular items fast (CDN).

A waiter remembers your table. Good app servers deliberately remember nothing between requests (they're 'stateless'), so any server can handle your next request. That's exactly what makes it easy to add more servers.

How it works

  1. Client: the phone app is the client. It sends a request: 'upload this photo with this caption'.
  2. DNS: the app asks DNS for the address of api.example.com and gets back an IP address — like a phone number for a server.
  3. Load balancer: the request reaches the load balancer, which picks one of many app servers that is healthy and not too busy.
  4. App server: your code checks who the user is, gets an upload link from object storage, and saves the caption and photo details in the database.
  5. Database: the permanent record of users, posts and likes. It's the source of truth.
  6. Queue and workers: the app server puts a message 'make thumbnails for photo 42' on a queue and replies straight away. A background worker picks it up and makes the thumbnails.
  7. Cache: when friends open the post, the app server checks the cache (fast memory) first, and only reads the database on a miss.
  8. CDN: the photo itself is downloaded from a CDN server near each friend, not from your own servers.

Example

Netflix, Instagram, Uber and a small startup all share this shape. What changes is the size of each box and which boxes matter most: Netflix leans on its CDN, Uber on live location, a bank on its database and transactions.

Key points

Common mistakes

Not true: A small app: still needs the CDN, the cache, the queue and the load balancer.
In fact: Each box is added to solve one problem. A small app may need only one server and one database.

Not true: Source of truth: the cache, since reads go there first.
In fact: The cache holds copies for speed and can be emptied at any time. The database is the source of truth.

In the interview

Most designs start from the same shape. Clients reach us through DNS, and files come from a CDN. A load balancer spreads requests across stateless app servers. Those servers read from a cache and a database, push slow work onto a queue for workers, and keep large files in object storage. Then I scale whichever box the requirements stress most.

Part of Unit 0: How system design interviews work in the free System Design course.