TCP (TCP)

Protocol

Transmission Control Protocol. The reliable, ordered, connection-oriented transport protocol underneath HTTP/1.1 and HTTP/2. TCP's three-way handshake adds latency, which is why HTTP/3 moved to QUIC over UDP.

Updated Mar 9, 2026

Full Explanation

TCP guarantees that bytes arrive in order and without corruption. It does this through sequence numbers, acknowledgments, and retransmission of lost packets. Every TCP connection starts with a three-way handshake: SYN, SYN-ACK, ACK—that's one full round trip before any data flows.

For CDNs, TCP matters because each new connection to an edge server costs at least one RTT for the handshake (plus another for TLS). That's why connection reuse (HTTP keep-alive) and connection pooling between edge and origin are critical optimizations. A CDN PoP close to the user shortens that initial handshake dramatically.

TCP also has congestion control algorithms (slow start, cubic, BBR) that determine how quickly a connection ramps up throughput. On a cold connection, TCP starts conservatively and increases its send rate as it confirms the network can handle it. This means small files often finish transferring before TCP even reaches full speed.

Examples

Checking TCP connection setup with curl:

# Show TCP connect time separately
curl -w "TCP connect: %{time_connect}s\nTLS done: %{time_appconnect}s\nTotal: %{time_total}s\n" -o /dev/null -s https://cdn.example.com/style.css

# TCP connect: 0.012s
# TLS done: 0.035s
# Total: 0.042s

Nginx upstream keepalive to avoid repeated TCP handshakes to origin:

upstream origin {
    server origin.example.com:443;
    keepalive 64;  # pool of idle connections
}

server {
    location / {
        proxy_pass https://origin;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }
}

Video Explanation

Frequently Asked Questions

Transmission Control Protocol. The reliable, ordered, connection-oriented transport protocol underneath HTTP/1.1 and HTTP/2. TCP's three-way handshake adds latency, which is why HTTP/3 moved to QUIC over UDP.

Checking TCP connection setup with curl:

# Show TCP connect time separately
curl -w "TCP connect: %{time_connect}s\nTLS done: %{time_appconnect}s\nTotal: %{time_total}s\n" -o /dev/null -s https://cdn.example.com/style.css

# TCP connect: 0.012s
# TLS done: 0.035s
# Total: 0.042s

Nginx upstream keepalive to avoid repeated TCP handshakes to origin:

upstream origin {
    server origin.example.com:443;
    keepalive 64;  # pool of idle connections
}

server {
    location / {
        proxy_pass https://origin;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }
}

Related CDN concepts include:

  • UDP (UDP) — User Datagram Protocol. A connectionless, lightweight transport protocol with no handshake, ordering, or delivery guarantees. …