Lesson 2 of 3
What happens when a page loads
2 min
Between typing an address and seeing a page, several systems work in sequence.
The request path
- DNS turns the domain into the server's IP address.
- The browser opens a TCP connection to port
443and performs a TLS handshake to encrypt the traffic. - It sends an HTTP request, e.g.
GET /pricing. - The web server (Nginx, Apache or LiteSpeed) receives it. A static file such as an image is returned directly.
- A dynamic page is passed to the application: PHP for WordPress, or Node.js, Python and others.
- The application usually queries a database (MySQL or PostgreSQL) and builds the HTML.
- The response travels back with a status code:
200OK,301redirect,404not found,500server error.
Where speed comes from
- Caching: storing a finished page so steps 5 and 6 are skipped for the next visitor.
- A CDN: copies of static files on servers close to the visitor.
- Fast storage: NVMe drives make database reads much quicker.
- HTTP/2 and HTTP/3: many files over one connection.
The most common cause of a slow site isn't the server. It's an unoptimised application making too many database queries or loading huge images.
See it yourself
curl -I https://insidx.com-I shows only the response headers: status code, server and caching information.