The Complete Request–Response Lifecycle
Request–Response Lifecycle
A request travels through several layers before the application handler executes.
A browser or client first resolves the hostname using DNS. It establishes a TCP connection and, for HTTPS, performs a TLS handshake. The client sends an HTTP request through potentially several network components such as a CDN, load balancer, reverse proxy, or API gateway. The application authenticates and validates the request, executes business logic, accesses data, serializes a response, and sends it back.
Understanding this lifecycle is essential for debugging latency, authentication problems, proxy failures, CORS issues, and production outages.
An API request can pass through many layers.
Latency is not necessarily caused by application code.
DNS, TLS, proxies, gateways, databases, and serialization can all affect performance.