TCP/IP Fundamentals for CDN Engineers

· Alex Petrov · 9 min read

TCP/IP (Transmission Control Protocol / Internet Protocol) is the foundational protocol suite that enables all communication on the internet — every email, web page, video stream, and API call relies on it. Developed in the 1970s by Vint Cerf and Bob Kahn as part of a U.S. Department of Defense research project, TCP/IP replaced the original ARPANET protocols and became the universal standard for networked communication. For CDN engineers, understanding TCP/IP is essential because CDN TCP optimization directly impacts content delivery performance.

How Was TCP/IP Created?

The story of TCP/IP begins with ARPANET, the world's first packet-switched network, which went live on October 29, 1969 — connecting UCLA, Stanford, UC Santa Barbara, and the University of Utah. ARPANET used a protocol called NCP (Network Control Protocol) that worked well for a single, homogeneous network but couldn't interconnect different types of networks.

In 1973, Vint Cerf (then at Stanford) and Bob Kahn (at DARPA) published "A Protocol for Packet Network Intercommunication," describing a new protocol that could connect disparate networks into an "internetwork." This protocol evolved into TCP/IP through several iterations:

Cerf and Kahn received the Presidential Medal of Freedom in 2005 and the Turing Award in 2004 for their work — recognition that TCP/IP is arguably the most impactful engineering achievement of the late 20th century.

TCP/IP 4-Layer Model — Each layer provides services to the layer above and uses services from the la TCP/IP 4-Layer Model — Application, Transport, Internet, and Link layers TCP/IP 4-Layer Model Application Layer HTTP/HTTPS, DNS, FTP, SMTP, SSH, WebSocket Transport Layer TCP (reliable, ordered) | UDP (fast, connectionless) | QUIC Internet Layer IP (IPv4/IPv6), ICMP, ARP, routing protocols (BGP, OSPF) Link Layer Ethernet, Wi-Fi (802.11), fiber optic, cellular (4G/5G) Layer 4 Layer 3 Layer 2 Layer 1 Data flows down when sending, up when receiving — each layer adds/removes headers
Figure 1: TCP/IP 4-Layer Model — Each layer provides services to the layer above and uses services from the layer below

What Are the Four Layers of TCP/IP?

TCP/IP organizes network communication into four layers, each with specific responsibilities:

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

1. Link Layer (Network Access): Handles the physical transmission of data over a specific medium — Ethernet cables, Wi-Fi radio waves, fiber optic light pulses, or cellular signals. This layer manages MAC addresses, frame formatting, and error detection at the hardware level. CDN edge servers typically connect via high-speed Ethernet (10/25/100 Gbps) to data center switches.

2. Internet Layer (IP): Responsible for addressing and routing packets across networks. The Internet Protocol (IP) assigns each device a unique address and determines the best path for packets to reach their destination. IPv4 uses 32-bit addresses (4.3 billion possible), while IPv6 uses 128-bit addresses (340 undecillion possible). CDNs use BGP routing at this layer for anycast addressing.

3. Transport Layer (TCP/UDP): Provides end-to-end communication between applications. TCP guarantees reliable, ordered delivery through acknowledgments and retransmissions — essential for web pages and API calls. UDP prioritizes speed over reliability — used for DNS queries, video streaming, and gaming. QUIC, the protocol underlying HTTP/3, operates at this layer as a UDP-based transport with TCP-like reliability.

4. Application Layer: The protocols that applications directly interact with. HTTP/HTTPS for web content, DNS for name resolution, SMTP for email, and SSH for remote access all operate here. CDN edge servers primarily handle HTTP/HTTPS traffic, with Cache-Control headers controlling caching behavior.

How Does the TCP Three-Way Handshake Work?

Before any data can flow over TCP, the client and server must establish a connection through a three-step process called the "three-way handshake":

  1. SYN: The client sends a SYN (synchronize) packet to the server, proposing initial sequence numbers and connection parameters. This packet contains no application data.
  2. SYN-ACK: The server responds with SYN-ACK, acknowledging the client's SYN and sending its own synchronization data. The server allocates resources for the connection at this point.
  3. ACK: The client acknowledges the server's SYN-ACK. With this final packet, the connection is established, and data transfer can begin.

This handshake takes one full round-trip time (RTT). For a user in Sydney connecting to a server in New York (RTT ~250ms), the handshake alone adds 250ms before any content loads. With TLS on top, add another 1-2 RTTs for the TLS handshake — potentially 500-750ms of latency before the first byte of content arrives.

This is precisely why CDNs exist: by placing edge servers close to users, they reduce RTT from hundreds of milliseconds to single digits, dramatically accelerating the TCP handshake and subsequent data transfer.

How Do CDNs Optimize TCP Performance?

CDN providers employ several TCP optimizations that go beyond simple geographic proximity:

What Is the Difference Between IPv4 and IPv6?

FeatureIPv4IPv6
Address Size32 bits (4 bytes)128 bits (16 bytes)
Address Format192.168.1.12001:0db8:85a3::8a2e:0370:7334
Total Addresses~4.3 billion~340 undecillion
Header Size20-60 bytes (variable)40 bytes (fixed)
NAT RequiredYes (address exhaustion)No (enough addresses)
IPsecOptionalBuilt-in support
CDN SupportUniversalAll major CDNs support dual-stack
TCP Three-Way Handshake — The SYN → SYN-ACK → ACK sequence establishes a reliable connection before TCP Three-Way Handshake — SYN, SYN-ACK, ACK sequence diagram TCP Three-Way Handshake Client Server SYN (seq=x) "I want to connect" SYN-ACK (seq=y, ack=x+1) "OK, let's connect" ACK (ack=y+1) "Connected! Sending data..." 1 RTT CDNs reduce handshake latency by placing edge servers close to users (RTT: 200ms → 5ms)
Figure 2: TCP Three-Way Handshake — The SYN → SYN-ACK → ACK sequence establishes a reliable connection before data transfer begins

When Should You Use TCP vs UDP?

The choice between TCP and UDP depends on whether your application prioritizes reliability or speed:

External References

References & Standards: HTTP/2 specification · RFC 7234