Photo by Jordan Harrison on Unsplash
HTTP Connection Coalescing: Reusing TCP Streams Across Domains
When you load a modern web page, your browser typically needs resources from multiple domains: the main site, CDN endpoints, analytics providers, and third-party widgets. The traditional model requires a separate TCP connection for each origin, but HTTP/2 introduced connection coalescing, a mechanism that lets browsers reuse a single connection for multiple domains under specific conditions.
The TCP Connection Overhead Problem
Establishing a TCP connection is expensive. You pay for the three-way handshake, TLS negotiation (which adds multiple round trips), and TCP slow start, where the connection gradually ramps up throughput. If your page loads assets from cdn1.example.com, cdn2.example.com, and static.example.com, that’s three separate connections, each with its own overhead.
Mobile networks and high-latency connections amplify this cost. A single round trip might take 100-200ms on a cellular network. Opening three connections means paying that penalty three times before any actual data transfers.
How Connection Coalescing Works
HTTP/2’s multiplexing capability is the foundation. Unlike HTTP/1.1, where each request blocks until its response completes, HTTP/2 interleaves multiple request-response streams over a single TCP connection. This makes it technically feasible to serve different origins from one connection.
The browser performs coalescing when it discovers that multiple domains resolve to the same IP address and the server’s TLS certificate covers all those domains. The process looks like this:
- Browser needs a resource from
cdn2.example.com - DNS resolution shows it shares an IP with an existing connection to
cdn1.example.com - Browser checks the TLS certificate from the existing connection
- If the certificate’s Subject Alternative Names (SAN) include
cdn2.example.com, the browser reuses that connection - The
Hostheader in the HTTP/2 request distinguishes which domain the request targets
Certificate Requirements
The certificate validation is critical for security. Coalescing only happens when the server explicitly claims authority over both domains through its certificate. This prevents a malicious actor from hijacking traffic intended for other sites that happen to share an IP address.
Wildcard certificates make this straightforward. A cert for *.example.com allows the browser to coalesce connections across cdn1.example.com, cdn2.example.com, api.example.com, and any other subdomain. Multi-domain certificates with explicit SAN entries work the same way.
Some CDNs use shared IP addresses across many customers. Without proper certificate coverage, coalescing won’t happen even when the IP matches, which maintains security boundaries between tenants.
Performance Impact
The gains are most visible in high-latency environments. Eliminating two connection setups can save 200-400ms on mobile networks. You also avoid TCP slow start multiple times, since the reused connection is already at full throughput.
There’s a subtle benefit for server infrastructure too. Fewer connections mean less memory overhead for connection state, fewer file descriptors consumed, and reduced load balancer tracking burden.
Deployment Considerations
If you control multiple subdomains serving static assets, ensure your TLS certificate covers all of them. Point them to the same IP addresses through DNS. The browser handles the rest automatically when it detects the opportunity.
HTTP/3 with QUIC extends this concept further, using connection IDs that can survive IP address changes. This enables coalescing even when the client moves between networks, though adoption is still growing.
Load balancers and reverse proxies need to support HTTP/2 properly, including the ability to route requests based on the Host header when multiple origins arrive on a single connection. Most modern infrastructure handles this transparently.
Connection coalescing represents the kind of protocol-level optimization that becomes more valuable as web applications fragment across multiple origins. By collapsing connection overhead, it makes the performance cost of domain sharding and CDN distribution substantially cheaper.