CDN Protocol Optimization: TCP, TLS, and Transport Tuning

· Mei-Lin Wu · 4 min read

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:

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages
CDN Protocol Stack — Layered network architectureCDN Protocol Stack — Layered network architecture CDN Protocol Stack Application Layer HTTP/2, HTTP/3, WebSocket Layer 5 Security Layer TLS 1.3 / Certificate Pinning Layer 4 Transport Layer TCP (HTTP/2) or QUIC (HTTP/3) Layer 3 Network Layer IP / Anycast Routing Layer 2 Physical Layer Fiber / Peering / IXP Layer 1 Higher ← Abstraction → Lower
Figure 1: CDN Protocol Stack — Layered network architecture
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 KB

CDN 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

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).

Protocol Handshake Flow — Connection establishment sequenceProtocol Handshake Flow — Connection establishment sequence CDN Request Flow — From Browser to Edge CDN Request Lifecycle Step 1 DNS Lookup Step 2 TCP Connect Step 3 TLS Handshake Step 4 Edge Server Step 5 Cache Check Step 6 Response Cache HIT → 5ms response Cache MISS → Fetch origin 0ms ~50ms (cache hit) ~200ms (cache miss)
Figure 2: Protocol Handshake Flow — Connection establishment sequence

CDN-to-Origin Optimization

CDNs also optimize the connection between edge and origin:

External References

References & Standards: OWASP CDN Security · W3C Web Performance