Request/Response Lifecycle Lab (Interactive)
Toggle DNS, TLS, keep-alive, edge SSL, Redis, and gzip to build a per-hop latency budget. Walk a request from browser through DNS, TCP/TLS, CDN, load balancer, app server, and database, computing real millisecond totals.
Request Lifecycle Latency Budget
Browser → DNS → TCP/TLS → Edge → LB → App → Cache/DB → Render: toggle each optimization and watch the total.
Full recursive resolution Root → TLD → Authoritative adds ~75 ms.
SYN → SYN-ACK → ACK costs 1 RTT (40 ms). Keep-alive amortizes it to 0.
TLS 1.3 folds the key share into ClientHello: 1 RTT.
TLS termination, DDoS rate-limit rules, and header inspection at the PoP.
Path routing (/api → Orders fleet) plus X-Request-ID injection.
JWT validation + business logic. Crypto already offloaded at the edge (frees 10–30% CPU).
Cache MISS: pooled connection executes an indexed read in ~12 ms.
50 KB JSON compresses to 8.0 KB — 0.1 ms saved on a 5 Mbps link.
DOM + CSSOM → Layout → Paint within one 16 ms frame (60 FPS budget).
NetworkSecurity/EdgeComputeStorage
How It Works Under the Hood
Every web request traverses layered infrastructure, and each layer contributes milliseconds: a cold recursive DNS lookup adds 50–100ms, the TCP handshake costs 1 RTT, TLS 1.3 another, and the edge–LB–app–DB chain another 25–50ms. The big wins are reuse: keep-alive collapses handshakes to zero, a Redis HIT answers in 0.3ms instead of a 12ms SQL query, edge TLS termination frees 10–30% of app CPU, and gzip shrinks a 50KB JSON body to 8KB. Warm cached requests complete under 50ms; cold first visits exceed 300ms.
Core Architectural Principles
- Cold request = DNS (0–100ms) + TCP 1 RTT + TLS 1–2 RTT + edge/LB forwarding + app + DB.
- Connection pooling avoids a fresh TCP handshake to the database on every query.
- Response-path optimization: Brotli compression, HTTP/2 multiplexing, and Cache-Control headers eliminate round trips.
Asked "what happens when you click Submit?", walk the layers in order with numbers: "DNS adds 50–100ms cold, keep-alive makes handshakes free, a cache HIT returns in under a millisecond versus 12ms for SQL." Citing connection pooling and edge TLS termination demonstrates production awareness beyond textbook hops.
Each protective/routing layer (CDN, WAF, LB) adds 5–20ms of cumulative latency while providing security, scalability, and observability.