Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Courses/Foundations of Scale
Lesson 1 of 16

How a web request travels

Follow one request from the browser to the database and back, and see where time and failures hide.

12 min read

From URL to response

When a user opens a page, a surprising number of steps happen before the first byte arrives. The browser resolves the domain name to an IP address through DNS, opens a TCP connection, negotiates TLS for HTTPS, and only then sends the HTTP request. On a fresh connection to a server 100 ms away, that setup alone can cost two or three round trips before any work is done. The response then has to travel back the same distance. This is why reusing connections, serving from nearby locations and avoiding extra round trips matter as much as fast code.

  • DNS lookup: name to IP address, usually cached after the first time
  • TCP and TLS handshakes: one to three round trips on a new connection
  • HTTP request and response: one more round trip plus server time

The tiers behind the front door

Once the request reaches your infrastructure it usually passes through the same few tiers. A load balancer or API gateway accepts the connection and picks an application server. The application server runs your code: it checks who the user is, validates the input and decides what data it needs. It then talks to data tiers such as a cache, a database or object storage, assembles a response and sends it back. Each hop adds latency, and each tier has its own capacity limit. On the SystCode canvas these tiers are the components you drag in and the edges you draw between them.

  • Edge: DNS, CDN, load balancer
  • Compute: stateless application servers
  • Data: cache, database, object storage, queues

Latency adds up along the path

End-to-end latency is roughly the sum of every hop on the critical path. If the load balancer adds 1 ms, the service spends 5 ms on logic, and it makes three sequential database queries of 10 ms each, the request takes about 36 ms plus network time to the user. Two things follow. First, sequential calls are expensive: three queries in parallel would cost about 10 ms instead of 30 ms. Second, the slowest dependency sets the floor. The Feedback panel reports latency per path, so you can see which component dominates and fix that one first.

Every hop is also a failure point

Each tier on the path can be slow, overloaded or down, and the user only sees the result of the whole chain. A request that touches five components, each available 99.9% of the time, succeeds about 99.5% of the time, which is more than three and a half hours of failures a month. Early in a design, draw the full path for your most important request and ask two questions of every box: how much traffic does it get, and what happens if it disappears? The rest of this course gives you the tools to answer both.

Key takeaways

  • A request crosses DNS, connection setup, a load balancer, application servers and data stores
  • Latency is the sum of sequential hops, so parallelise or remove calls on the critical path
  • Every component on the path is a capacity limit and a potential failure point

Sign in to track lessons and earn badges.

Back-of-the-envelope estimation

Coming up

Course: 0/16 lessons · 0/10 challenges0%

Build it on the canvas, pass the review (70+) and mark it complete to count it toward the course badge.

  1. 1/10Design a URL ShortenerEstimate peak redirects per second and size a stateless API tier behind a load balancer to serve them.Easy
  2. 2/10Design a Session StoreMove login sessions out of the web tier into a replicated in-memory store with TTLs and a clear fallback.
Easy
All 10 challenges →