Connection Overhead and Timing
You'll learn how to identify the hidden time costs before a server even starts sending you data—the DNS lookup, TCP connection, and TLS handshake phases visible in your waterfall charts.
The Three Hidden Phases
When you look at a request waterfall (like in Chrome DevTools Network tab), you might notice that a request shows several colored segments before the actual download begins. These represent connection overhead—the preparatory work browsers must do before exchanging data.
DNS Lookup (Grey/Teal)
Before your browser can connect to example.com, it must translate that domain name into an IP address. This DNS lookup can take 20-200ms, especially on first visit. Think of it like looking up a phone number in a directory before you can dial.
TCP Connection (Orange)
Once the browser knows the IP address, it establishes a TCP connection through a three-way handshake (SYN, SYN-ACK, ACK). This typically adds 50-100ms depending on distance to the server. It's like two people confirming "Can you hear me?" before starting a conversation.
TLS Handshake (Purple)
For HTTPS sites, there's an additional security negotiation where browser and server exchange certificates and agree on encryption keys. This adds another 50-100ms. Picture it as two parties verifying each other's identity before sharing secrets.
Reading the Waterfall
In DevTools, hover over a request's timing bar. You'll see a breakdown showing:
- DNS Lookup: Domain resolution time
- Initial connection: TCP handshake
- SSL: TLS negotiation (HTTPS only)
- Waiting (TTFB): Time until first byte arrives
- Content Download: Actual data transfer
These first three happen once per connection. HTTP/2 and connection reuse eliminate this overhead for subsequent requests to the same origin—which is why you'll see them as (from cache) or take 0ms.
Key Takeaway: Connection overhead (DNS + TCP + TLS) can add 100-400ms per new connection before any data transfers—understanding these phases helps you optimize through techniques like DNS prefetching, connection prewarming, and reducing origin diversity.