GOAT EngineerPreparing your learning space…

System Design · Concept Library · Free article

Anatomy of a Web Request

How DNS, connection setup, TLS, HTTP, and application work combine when a browser loads a page.

On a traditional cold HTTPS connection, the browser may need to find the address (DNS), open a line (TCP), make it private (TLS), and then ask for the page (HTTP). Those stages cross different network paths and add latency before and around the server's work. A warm connection can skip most setup, while HTTP/3 uses QUIC instead of TCP. Measure the waterfall before deciding which stage to optimise.

What happens when you type a URL and press Enter?

The browser resolves the name to an address (DNS), opens a connection to it (TCP), secures that connection (TLS), and only then asks for the page (HTTP). The server does its work and replies. A good answer follows the request through the network instead of jumping straight to the server.

The browser first finds the right computer, opens a connection, secures it, and sends the request. The server then does its work and returns a response. The exact path depends on caches, connection reuse, and the protocol in use.

The journey, end to end

Picture a user in one city opening a site whose server sits on another continent. The model below shows one illustrative cold HTTPS-over-TCP path. DNS may use a nearby resolver rather than the origin path, and warm or HTTP/3 connections take a different route. Drag the distance and switch visits to see the setup cost change.

The interactive version of this example is available when JavaScript loads.

Two things stand out once the distance moves. The setup stages scale with it together, because DNS, the connection and the security negotiation are each a separate crossing of the same ocean, so doubling the distance roughly doubles all of them at once rather than adding a fixed cost somewhere. And the stage a reader expects to dominate, the server doing its work, barely moves at all: it is the same handful of milliseconds whether the user is in the next city or on another continent. That is the shape worth carrying away. On a cold visit to a distant server, most of the wait is arranged before the request is even asked.

The four steps, one at a time

1. Find the address: DNS. A name like hatch.app means nothing to the network; it routes by numbers. So the browser first looks up the numeric address for that name. The first lookup takes a small journey; after that the answer is remembered for a while. → DNS, in full

2. Open a line: TCP. Now the browser opens a reliable connection to that address with a short three-step greeting, so both sides know they can hear each other before any real data flows. → TCP & the handshake

3. Protect the content: TLS. On a secure site, the two sides set up an encrypted channel. A network observer cannot read the protected application content, although connection metadata such as endpoints, timing, and volume may remain visible. This is the s in https. → TLS & HTTPS

4. Ask for the page: HTTP. Finally, the real request: "give me this page." The server does its work and replies. Everything before this was just getting ready to ask. → HTTP, in full

Why is the first visit slower than the next one?

A cold visit may require DNS resolution, a new connection, and a new TLS handshake. Later requests can be faster when a valid DNS answer is cached and a suitable connection remains open. Cache state, protocol, and server behaviour determine which work is skipped.

Where does the time actually go?

Server code is only one part of page latency. In this illustrative first visit, most of the time is spent on network travel and connection setup:

A first visit to a far-away server (rough numbers, one trip ≈ 80 ms).
StepRoughlyIs this your code?
Find the address (DNS)~80 msNo: travel
Open the line (TCP)~80 msNo: travel
Make it private (TLS)~160 msNo: travel
Ask & answer (HTTP)~80 msMostly travel
Server does the work~4 msYes: your code

What to remember

Sources and further reading

By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.