The Path of a Request: A Tour of Modern Web Architecture
Hop by hop through modern infrastructure: trace how DNS, Anycast CDNs, reverse proxies, API gateways, service meshes, and databases process a web request.
On this page
When a user taps an icon or navigates to a URL, a modern web page loads in under 500 milliseconds. Yet in that half-second window, the request traverses roughly ten distinct distributed systems across the globe. Each layer acts as an architectural funnel: absorbing traffic, filtering threats, terminating security protocols, and narrowing the volume of work passed downstream.
Understanding how each hop functions: and the precise architectural trade-off each makes: is foundational to designing reliable, low-latency distributed platforms.
The Architecture of the Request Funnel
+-----------------------------------------------------------------------+
| The Request Funnel: Hop by Hop |
+-----------------------------------------------------------------------+
| |
| [ Client Browser / Mobile App ] |
| | |
| +---> Hop 1: DNS Resolution (Recursive Resolver -> Authoritative)
| | |
| v |
| [ Anycast Edge CDN / WAF ] |
| | (Absorbs 80-90% of requests via edge caching & DDoS filter)
| v |
| [ Cloud Load Balancer (Layer 4 / Layer 7) ] |
| | (TLS Termination, HTTP/3 to HTTP/2, TCP multiplexing) |
| v |
| [ API Gateway / Reverse Proxy (Envoy / Kong) ] |
| | (Authentication, JWT verification, Rate Limiting) |
| v |
| [ Service Mesh Sidecar (mTLS Envoy) ] |
| | (Distributed tracing, circuit breaking, service discovery) |
| v |
| [ Application Microservice (Node / Go / Java) ] |
| | (Business logic execution, serialization) |
| | |
| +---> In-Memory Cache (Redis): 90% cache hit (~1ms) |
| v |
| [ Relational Database (PostgreSQL / MySQL Primary) ] |
| | (ACID transaction execution, WAL disk write) |
| v |
| [ Response Stream Unwinds Back to Client Browser ] |
+-----------------------------------------------------------------------+
Hop by Hop Breakdown
Hop 1: DNS Resolution (Finding the Edge)
Before a single HTTP byte leaves the client, the hostname (app.example.com) must resolve to an IP address:
- The browser checks local memory cache and operating system cache.
- If missed, it queries the ISP or public recursive resolver (such as Cloudflare
1.1.1.1or Google8.8.8.8). - The resolver navigates the root servers, TLD servers, and authoritative nameservers, returning an Anycast BGP IP address.
Trade-off: High TTLs cache DNS effectively but delay emergency failover; low TTLs allow rapid IP migration but add 20 to 80ms of lookup latency to cold sessions.
Hop 2: The Anycast CDN & WAF Edge
The client establishes a TCP and TLS 1.3 connection with the physically closest Edge Point of Presence (PoP) via Anycast routing:
- DDoS Scrubbing: Massive volumetric attacks (SYN floods, UDP amplification) are absorbed at the edge.
- Edge Caching: Static assets (images, JavaScript bundles) and cached API responses are returned immediately in under 15ms.
Trade-off: Only 10% to 20% of dynamic, authenticated traffic bypasses the cache and proceeds toward the origin data center.
Hop 3: Regional Cloud Load Balancer
Dynamic requests arrive at the origin cloud facility. The Layer 4 / Layer 7 load balancer (such as AWS ALB or Google Cloud Armor):
- Terminates external TLS handshakes, offloading cryptographic decryption from internal backend containers.
- Translates external HTTP/3 (QUIC) or HTTP/2 connections into persistent, multiplexed HTTP/2 or gRPC keepalive connections to upstream proxies.
Hop 4: API Gateway & Perimeter Security
The API Gateway is the central policy enforcement point:
- Authentication: Validates JWT signatures, checks expiration, and rejects unauthenticated traffic.
- Rate Limiting: Enforces token-bucket algorithms per API key, dropping abusive callers with HTTP 429.
- Routing: Rewrites URL paths (
/v1/orders/*->orders-service:8080).
Trade-off: Centralizing policies simplifies governance, but an inefficient gateway quickly becomes a single point of failure and latency bottleneck.
Hop 5: Service Mesh Sidecar
Inside Kubernetes, traffic hits an ingress proxy or service mesh sidecar (e.g., Envoy):
- Enforces zero-trust mutual TLS (mTLS) with cryptographically verified service identities.
- Injects OpenTelemetry distributed tracing headers (
traceparent,x-request-id). - Manages local circuit breaking and client-side load balancing across healthy container replicas.
Hop 6: Application Logic & Caching
The application runtime (Node.js, Go, or Java) executes domain logic:
- It queries an in-memory Redis cluster for pre-computed user permissions or session state (1ms latency).
- If missed, it acquires a connection from an internal database connection pool.
Hop 7: The Relational Database
The final stop is the primary relational database:
- The SQL query parser validates syntax and the planner generates an execution plan.
- The engine reads table pages from the shared buffer pool cache in RAM, or reads NVMe storage.
- If executing a write, the engine appends to the Write-Ahead Log (WAL) to guarantee ACID durability before committing.
The Response Unwinds
Once the database returns, the response payload traverses the reverse path: serialized into JSON or Protobuf, stamped with span metrics by Envoy, compressed (gzip/Brotli) by the gateway, and streamed back across the CDN edge to the user’s browser in roughly 300 to 500 milliseconds.
Key Engineering Takeaways
- Architecture is a funnel: High-performance systems prevent traffic from reaching the database. CDNs, edge caches, gateways, and Redis absorb 95% of requests.
- Terminate TLS early: Terminating TLS at the CDN edge dramatically reduces handshake round-trips for mobile clients on high-latency wireless links.
- Trace the full path: Always propagate trace context headers across every hop. Without distributed tracing, diagnosing a 200ms latency regression across ten hops is nearly impossible.
/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.