Designbench

Lesson 1.1 · 15 min

How a request flows

Follow reads, writes and images through every hop, break each hop on purpose, and learn the 30-second opening for any design answer.

The idea in plain words

Opening a web page is like posting a letter: it has to find the address, travel there, be handled, and travel back. Each stop on the way adds a little time, and any stop can break.

The problem it solves

Your code runs on servers in one place, but users are everywhere. Every request has to find those servers, travel to them, get handled, and travel back, and each of those steps takes time and can break.

How it works

  1. The browser asks DNS for the server’s IP address (and remembers it for later).
  2. It opens a secure connection: a couple of round trips before any data moves.
  3. A CDN near the user answers for static files like images; everything else travels on to your region.
  4. A load balancer hands the request to one of many identical app servers.
  5. The app server checks a cache first and only asks the database when the cache doesn’t have the answer.
  6. The response travels back the same way.

Example

A user in Mumbai opens a page hosted in Virginia. Each round trip there and back takes about 190 ms, while your servers spend about 30 ms. So the page is slow because of distance, not code, which is why CDNs, connection reuse and nearby regions matter more than faster servers.

Key terms

DNS
The internet’s phone book: turns a name like designbench.dev into the IP address of a server.
CDN
A network of servers near users that keep copies of files, so they don’t have to travel far.
Load balancer
Hands each incoming request to one of several identical servers.
Cache
A small, fast store of recent answers, so you don’t ask the slow database again.
Round trip (RTT)
The time for a message to reach a server and the reply to come back.
Stateless server
Keeps nothing about a user between requests, so any server can answer any request.

In this lesson you'll learn

Sections

  1. Theory: follow a request
  2. Theory: break a hop
  3. Theory: stateless servers
  4. Design: say it in 30 s
  5. Design: latency budget
  6. Check yourself

Cheat sheet

New connection2 round trips (TCP + TLS 1.3)
Far userdistance, not servers, is the cost
Read pathCDN → cache → replica
Write pathprimary → delete cache key → queue
Sessionsshared store or signed token, never only one server

The interactive simulations and the quiz load with JavaScript.