Video summary
Why Games Choose the Unreliable Protocol - TCP vs UDP
Main summary
Key takeaways
Summary
The video explains why applications choose TCP, UDP, or QUIC based on what happens when data is lost or delayed—not simply whether a protocol is “reliable.”
How TCP Connections Work
- A TCP connection is not a dedicated path through the network. Routers forward packets and generally do not retain connection state; the two endpoints maintain matching state such as sequence numbers, acknowledgements, and receive capacity.
- Routers commonly hash packet addresses and ports to keep a connection on the same path. If a link fails, packets may take a different route.
- NATs and firewalls are exceptions: they keep connection-tracking entries that can expire. The video notes that idle TCP entries may persist much longer than UDP entries, so applications often send keep-alives.
What TCP Provides
The operating system’s TCP implementation:
- Splits data into segments and numbers the bytes.
- Retransmits lost data, using acknowledgements and techniques such as fast retransmit or timing-based RACK.
- Buffers out-of-order segments and delivers data to applications in order.
- Controls congestion. Traditional loss-based TCP treats packet loss as a possible sign of congestion and slows down; this can also penalize connections where loss comes from weak Wi-Fi. The video contrasts this with Google’s BBR, which estimates bottleneck speed and delay.
These features make TCP a convenient default, but ordered delivery can hold up data that has already arrived.
Head-of-Line Blocking and QUIC
HTTP/2 can carry multiple request streams over one TCP connection. Because TCP sees one ordered byte stream, a lost packet in one stream can delay delivery of data from other streams, even when their data has arrived. This is head-of-line blocking.
QUIC runs over UDP and handles reliability and ordering separately for each stream, so a loss in one stream need not block delivery on another. However, congestion control still applies to the connection as a whole.
The video also highlights QUIC’s integrated connection setup and connection IDs, which can help a connection survive a client’s switch between networks. It says HTTP/3 is most useful on lossier or higher-latency connections, while the difference may be small on clean, fast ones.
Why Games Use UDP
For fast-changing game state, a recent update is often more valuable than a delayed, retransmitted one. If an old player-position update is lost, TCP may hold newer updates until it recovers the missing data, causing a visible freeze followed by a jump. UDP lets newer updates through without waiting.
Games can add reliability selectively: position updates may be sent once, while important events—such as a score change or player joining—can be acknowledged and resent. This requires developers to supply the transport features they need; a networking library can help. The same preference for timely data explains UDP’s use in voice and video calls.
The video contrasts calls and games with buffered video streaming: when a player has several seconds of video already buffered, waiting for a retransmission may be acceptable.
Practical Selection Guide
- TCP: Use when all data must arrive complete and in order, and occasional delay is acceptable—such as for APIs, databases, file transfers, and email.
- UDP: Use when fresh data matters more than recovering every old packet, as with games and real-time calls. Applications must handle any needed reliability and congestion control themselves.
- QUIC: Consider it when multiple streams share a connection and independent stream delivery is useful. Check that UDP traffic is actually working: some networks or VPNs may block or silently drop it. The video recommends logging which protocol connections really use, rather than assuming HTTP/3 support means HTTP/3 is being used.
The main takeaway is to choose based on the failure your application can tolerate: TCP may delay data, while UDP may lose it.
Speakers and Sources
- Main speaker: One narrator; no additional speakers are identified.
- Technologies and sources mentioned: TCP, UDP, QUIC/HTTP/3, HTTP/2, RACK, BBR, Valve’s networking library, and Cloudflare usage figures.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.