TCP vs UDP: what's the difference, and why does it matter for cloud apps?
TCP and UDP are the two main transport protocols on the internet. Almost all application traffic rides on one of them.
TCP (Transmission Control Protocol)
- Connection-based: a handshake sets up a connection before data flows.
- Reliable and ordered: lost packets are retransmitted, and data arrives in order.
- Congestion control: slows down when the network is overloaded.
- Used by most web traffic (HTTP/1.1 and HTTP/2), databases, SSH and email.
UDP (User Datagram Protocol)
- Connectionless: just sends packets, called datagrams.
- No built-in reliability or ordering. Packets can be lost, duplicated or arrive out of order.
- Low overhead and latency.
- Used by DNS lookups, voice and video calls, online games and QUIC, the transport under HTTP/3.
Why choose UDP if it's "unreliable"? For real-time media, a late packet is useless, so retransmitting it only adds delay. And protocols like QUIC build their own reliability on top of UDP to avoid some of TCP's limitations.
Why it matters in the cloud:
- Load balancers differ in what they support; some handle only TCP or HTTP.
- Firewall and security group rules are protocol-specific; allowing TCP port 53 doesn't allow UDP 53.
- Long-lived TCP connections affect scaling, connection limits and how deployments drain traffic.
- Timeouts on idle connections can quietly break things like database pools.
Have you ever debugged an issue that came down to TCP vs UDP rules? How does your team handle long-lived connections during deployments?
Comments · 3
I think of TCP as a phone call where both sides check they heard each other, and UDP as shouting across a field. Fast but no guarantee.
Online games mostly use UDP because a late packet is worse than a lost one. It's better to skip a frame than to wait for old data.
I've heard QUIC is changing this picture by building reliability on top of UDP. Is that right?