CDN Protocol Optimization: TCP, TLS, and Transport Tuning
Protocol Stack at the CDN Edge
Every HTTP response traverses a protocol stack: IP → TCP/QUIC → TLS → HTTP. CDNs optimize each layer for maximum throughput and minimum latency. For foundational context, read CDN Monitoring and Observability: Metrics That Matter — FlyFish NWA.
TCP Optimization
Initial Congestion Window (IW)
TCP starts slow (congestion control) and ramps up. The initial congestion window (IW) determines how much data the first flight can carry:
| 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 |
Default IW (Linux): 10 segments = ~14.6 KB
CDN-optimized IW: 10-30 segments = 14.6-43.8 KB
A typical HTML page (30 KB) with IW=10:
Flight 1: 14.6 KB → ACK → Flight 2: 14.6 KB → ACK → Flight 3: done
= 3 round trips to deliver 30 KB
With IW=30:
Flight 1: 30 KB → done
= 1 round trip to deliver 30 KBCDN edge servers use larger initial congestion windows because the connection between edge and user is typically low-latency and high-bandwidth.
TCP Fast Open (TFO)
TFO allows data in the SYN packet, saving one RTT on repeat connections. CDN edge servers enable TFO to reduce connection setup time for returning visitors.
BBR Congestion Control
Google's BBR (Bottleneck Bandwidth and Round-trip propagation time) congestion control algorithm outperforms CUBIC on lossy networks (mobile). CDN edge servers increasingly use BBR for better throughput on challenging last-mile connections.
TLS Optimization
TLS 1.3
TLS 1.3 reduces the handshake from 2 RTTs (TLS 1.2) to 1 RTT. With 0-RTT resumption, repeat connections send data in the first packet:
TLS 1.2: TCP SYN → SYN-ACK → ClientHello → ServerHello → ... → Data
= 3 RTTs before first data
TLS 1.3: TCP SYN → SYN-ACK → ClientHello+Data → ServerHello+Data
= 1 RTT before first data (0-RTT for repeat connections)OCSP Stapling
Without stapling, the browser checks certificate revocation with the CA (100-500ms added). CDN edge servers staple the OCSP response to the TLS handshake, eliminating this latency.
Certificate Optimization
- ECDSA certificates — Smaller than RSA (256 bytes vs. 2048 bytes), faster handshake
- Certificate chain optimization — Serve only necessary intermediate certificates
- Shared certificates — SAN certificates reduce per-domain overhead
HTTP/2 and HTTP/3
HTTP/2 multiplexing eliminates head-of-line blocking at the HTTP layer. HTTP/3 (QUIC) eliminates it at the transport layer too, and adds connection migration (network switches don't drop connections).
CDN-to-Origin Optimization
CDNs also optimize the connection between edge and origin:
- Persistent connections — Maintain warm TCP connections to origin, avoiding handshake latency
- Connection pooling — Share connections across requests from different users
- Optimized routing — Route via CDN's backbone network instead of public internet (Cloudflare Argo, Akamai SureRoute)
- Compression — Compress responses between origin and edge