The client resolves the hostname through DNS, opens a TCP connection to the resolved address or reuses an existing one, then completes a TLS handshake that validates the server certificate and agrees session keys. The encrypted request travels through load balancers and proxies to your application, which handles it and writes a response back over the same connection. Keep alive and HTTP/2 multiplexing let later requests skip most of the setup.
Why interviewers ask this
This is a breadth question, and the interviewer will follow your answer down to whichever layer you sound least sure about. Strong answers move cleanly through DNS, transport, TLS and the proxy chain, and point out where latency and failures actually come from, which is usually connection setup, stale DNS caching, or something in the middle terminating TLS and rewriting headers.
How to structure your answer
- Move layer by layer: DNS, TCP, TLS, HTTP, application.
- Say what the TLS handshake proves and what it agrees.
- Mention the proxy or load balancer chain in front of the app.
- Point out where connection reuse removes most of the cost.
Example answer
First the client needs an address, so it checks its own cache, then the OS resolver, then a recursive resolver, and gets back an IP with a time to live. Then a TCP handshake to that address, unless there is already an open connection in the pool, which there usually is. Then TLS: the server presents a certificate chain, the client validates it against its trust store and checks the hostname matches, and they agree session keys. With TLS 1.3 that is one round trip, or zero on a resumed session. The request goes out encrypted, and in practice it hits a CDN or load balancer first, which usually terminates TLS and opens its own connection to my service. My app handles it and the response comes back the same way. The reason I care about the sequence is latency: on mobile the first request pays DNS plus TCP plus TLS before a byte of my code runs, so connection reuse is often the biggest win available.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- What changes if the load balancer terminates TLS?
- How would you debug a certificate error you only see from one client?
- What does HTTP/2 multiplexing fix that keep alive did not?
Related software engineer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions