As asked
A customer reports that your just-launched API feels slow. You suspect the problem is not in your own code. Trace the full lifecycle of an HTTP POST request from the browser through DNS, TCP, TLS, your Node.js process, the database, and back, naming every point where latency can be introduced so you know where to look first.
Sample answer outline
DNS lookup (cacheable, TTL matters), TCP handshake (three-way), TLS handshake (1.3 reduces RTTs), HTTP request arrives at Node.js event loop, middleware chain (auth, parsing), database query (connection pool checkout, query execution, network to DB), response construction, and client-side rendering. Latency points: DNS TTL expiry, TLS negotiation on first connection, DB connection pool exhaustion, slow query, large response payload.
Expect these follow-ups
- What does Keep-Alive do and when would you disable it?
- Where does the overhead of a connection pool fit into this lifecycle and how do you measure it?