A classic question, and a useful map. Each step is a place where delay or failure can hide.
1. The browser parses the URL
It splits https://example.com/products?id=7 into scheme, host, path and query. It checks its caches and may already know the answer or hold a connection.
2. DNS lookup
The host name is resolved to an IP address, using the operating system cache, then a recursive resolver, as described in the article about DNS. A slow or failing resolver delays everything after it.
3. Connection and encryption
The browser opens a TCP connection to the server, a handshake that costs one round trip. For HTTPS it then performs a TLS handshake to agree on keys and verify the certificate. With HTTP/3 these two steps are combined over QUIC. Distance matters: every round trip across a continent costs tens to hundreds of milliseconds.
4. The HTTP request and the server's work
The browser sends a request such as GET /products?id=7 with headers for cookies, language and caching. Often a load balancer or CDN receives it first and may answer from its cache. If not, the request reaches the application, which may check authentication, query a database, call other services and render a response.
GET /products?id=7 HTTP/1.1
Host: example.com
Accept: text/html5. The response and rendering
The server replies with a status code, headers and a body, typically HTML. The browser then:
- Parses the HTML into the document tree and discovers CSS, JavaScript and images, which cause further requests.
- Builds the style information and computes the layout.
- Paints the pixels and runs JavaScript, which may change the page again.
CSS and synchronous scripts can block rendering, which is why performance work focuses on sending less, sending it earlier and caching it.
Where to look when it is slow. The browser's network panel shows a timeline per request: DNS, connection, waiting for the first byte and download. A long wait for the first byte points at the server, a long download at payload size.
Takeaway
A page load is many small steps: name, connection, security, request, response and render. Knowing the steps tells you where to measure.
Comments