What happened

Establishing an HTTP connection involves several steps, including TLS handshake and TCP three-way handshakes. These processes introduce significant latency, particularly when communicating across regions.

The initial 3 RTT (round trip times) can add up quickly, even with plentiful bandwidth or short requests. For example, a simple request to index.golang.org might still take over one RTT to fulfill, but the initial connection setup could cost 300 ms.

Why it matters

Network latency is a critical factor in application performance and user experience. Slow connections can lead to increased response times, slower page loads, and ultimately frustrated users.

Understanding how HTTP connection establishment impacts overall performance enables developers to make informed decisions about caching strategies, CDN usage, and network configurations.

But, but, but…

While TLS 1.3 and optimized protocols like HTTP/2 have reduced handshake latency, the fundamental cost of establishing a TCP connection remains.

It’s important to remember that the “cheap” request is only true when the connection exists already. Even in favorable conditions, opening a new connection can still be expensive. The benchmark queries on index.golang.org demonstrate low latency due to TLS 1.3 and a distributed network but show clear performance differences based on connection reuse.

“Opening a new connection can still be expensive, even when bandwidth is plentiful.”
— Dr Non

The counter-take

The industry often glosses over the fundamental cost of network connection establishment, leading to a misinformed understanding of application performance. Recognizing this overhead is crucial for proactive optimization and avoiding unnecessary delays.

The AI angle

As AI models become increasingly deployed across geographically distributed data centers, minimizing network latency becomes paramount. Optimizing connection reuse strategies is an essential step in ensuring the performance and scalability of these applications—upgrading network infrastructure for faster connections. This also creates asymmetry in resource consumption with larger models requiring increased bandwidth.