← Lessons

quiz vs the machine

Gold1400

Networking

TCP Versus UDP Tradeoffs Revisited

Choosing between guaranteed delivery and minimal overhead for a given workload.

5 min read · core · beat Gold to climb

Two philosophies

TCP and UDP are the two main transport protocols, and choosing between them is a recurring design decision. TCP offers a reliable, ordered byte stream with congestion control. UDP offers a thin, connectionless datagram service with almost no guarantees. Neither is better in the abstract; the right pick depends on what the application can tolerate.

When each wins

  • TCP suits transfers that must arrive complete and in order, such as files, web pages, and email.
  • UDP suits real time media and games where a late packet is useless and retransmission would only add delay.
  • TCP adds head of line blocking, where one lost packet stalls everything behind it.
  • UDP lets the application build its own lightweight reliability, sending only what it actually needs.

The tradeoff is reliability versus latency and control. TCP saves you from reimplementing acknowledgments and ordering, but its guarantees cost round trips and can stall under loss. UDP gives you a blank slate, which is why newer protocols build custom reliability on top of it to avoid TCP head of line blocking while still recovering lost data. The choice frames everything above it.

Key idea

TCP trades latency and control for a reliable ordered stream while UDP trades guarantees for a thin low latency datagram, so the choice hinges on whether the workload can tolerate loss and out of order delivery.

Check yourself

Answer to earn rating on the learn ladder.

1. Which workload is the best fit for UDP?

2. What problem does TCP introduce that UDP avoids?

3. Why do some newer protocols build reliability on top of UDP?