CDN Connection Coalescing: Reducing Overhead
What Is Connection Coalescing
Connection coalescing is an HTTP/2 feature that allows a browser to reuse an existing connection for a different hostname, if the connection's TLS certificate covers both hostnames and the DNS resolves to the same IP address. For foundational context, read DNS Resolution in CDN: How Users Reach the Nearest Edge — FlyFish NWA.
# Browser has a connection to cdn.example.com (IP: 104.16.1.1)
# Certificate covers: *.example.com
# www.example.com also resolves to 104.16.1.1
# Instead of opening a new connection for www.example.com:
# → Reuse the existing cdn.example.com connection
Why It Matters for CDNs
CDN customers often serve content from multiple hostnames: www.example.com for HTML, cdn.example.com for static assets, api.example.com for API calls. Without coalescing, the browser opens separate TCP+TLS connections for each — 3 hostnames = 3 handshakes = 120-300ms of connection overhead.
| Metric | Edge Processing | Origin Processing | Improvement |
|---|---|---|---|
| Latency (p50) | 8–15 ms | 120–300 ms | 15–20x faster |
| Cache Hit Ratio | 85–95% | N/A | Reduces origin load |
| TLS Handshake | 1–5 ms (nearby PoP) | 50–150 ms | 10–30x faster |
| Bandwidth Cost | $0.01–0.04/GB | $0.05–0.12/GB | 3–5x cheaper |
| Availability | 99.99% (multi-PoP) | 99.9% (single DC) | 10x fewer outages |
With coalescing, one connection serves all three: saving 2 complete TCP+TLS handshakes (80-200ms).
Requirements for Coalescing
All three conditions must be met:
- Same IP address — Both hostnames resolve to the same IP (common with CDN Anycast)
- Valid certificate — The TLS certificate covers both hostnames (wildcard *.example.com or SAN list)
- HTTP/2 or HTTP/3 — Coalescing only works with multiplexed protocols
CDN Coalescing in Practice
CDNs like Cloudflare serve all customer domains from the same Anycast IP ranges. If multiple domains are on the same CDN and share a certificate, the browser can coalesce connections across them.
Benefits are especially significant for:
- Sites using multiple subdomains behind the same CDN
- Third-party resources served from the same CDN as first-party content
- Micro-frontend architectures with multiple service hostnames
Configuring for Coalescing
- Use a wildcard or multi-SAN certificate — Cover all your hostnames on one certificate
- Ensure same IP resolution — All hostnames should resolve to the same CDN IPs
- Enable HTTP/2 — Required for coalescing to work
- Minimize hostnames — Fewer unique hostnames = more coalescing opportunities
Connection Coalescing vs Domain Sharding
Domain sharding (splitting assets across multiple hostnames to increase parallel connections) was an HTTP/1.1 optimization. With HTTP/2, it's counterproductive:
| Approach | HTTP/1.1 | HTTP/2 |
|---|---|---|
| Domain sharding | Beneficial (more parallel downloads) | Harmful (prevents coalescing, wastes connections) |
| Single domain | Bottleneck (6-connection limit) | Optimal (one multiplexed connection) |
If you're still using domain sharding from the HTTP/1.1 era, consolidating to fewer hostnames will improve HTTP/2 performance.
Monitoring Connection Efficiency
Chrome DevTools → Network tab shows connection IDs. Check if requests to different hostnames share the same connection ID (indicating successful coalescing). Multiple connection IDs for same-CDN hostnames indicate coalescing isn't working — check certificate coverage and DNS resolution.