Note · TLS

A handshake is not a connection

7 October 2026 · 4 min read

A latency graph showed a service taking eight hundred milliseconds to answer. The server logs said the request itself took nine milliseconds. The gap was not in the application. It was in everything that had to happen before the application saw a request at all.

For a new HTTPS request, the useful budget looks something like this: DNS lookup, TCP handshake, TLS handshake, then the first HTTP request, then the response. On a warm connection, most of that disappears. On a cold one, every step adds a round trip, and a round trip is expensive when the client and server are far apart.

TLS 1.3 reduced the handshake to one round trip in the common case, and session resumption can make a later connection cheaper still. That does not mean the first connection is free. It means the cost moved into a different part of the timeline. If you measure only the server’s request duration, you are measuring the part after the expensive work is already finished.

openssl s_client -connect host:443 -servername host \
  -brief </dev/null

That command is a decent first look: it tells you whether the handshake completes, which protocol and cipher were chosen, and roughly how long the setup took. Compare it with a plain TCP connect and with the time to first byte. If the handshake is slow but the request is fast, the problem is usually distance, packet loss, or something in the middle rather than the application.

The same confusion shows up with connection reuse. A pool with a healthy idle connection skips DNS and both handshakes entirely. A pool that has just evicted its connections pays for all of them at once. Two clients hitting the same endpoint can therefore have completely different latency profiles without either of them being wrong.

When a number looks impossible, split it into phases before you optimize it. The server’s nine milliseconds were real. So were the eight hundred. They were just measuring different parts of the same trip.

← All notes