Courses/System Design/Part 2/Transport Protocols

Transport Protocols (UDP, TCP, QUIC)

Comparing different transport layer protocols and their use cases

🎙️ How Data Gets Delivered — Fast, Reliable, or Both

When you send data across the internet — whether it's a message, a video, or an API call — it needs a delivery method. That's the job of transport protocols. They sit at Layer 4 of the OSI model and decide how data moves between devices. In this lesson, we'll compare the three major transport protocols: UDP, TCP, and QUIC — and understand when to use each.

🚚 What Is the Transport Layer?

Responsible for end-to-end communication between devices
Breaks data into segments and reassembles them
Adds headers with ports, sequence numbers, and delivery instructions
Ensures delivery is reliable, ordered, or fast, depending on the protocol

UDP (User Datagram Protocol)

What it is:

A lightweight, connectionless protocol
Sends data without guarantees — no delivery confirmation, no order, no retries

Analogy:

Like sending postcards — you drop them in the mailbox and hope they arrive. No tracking, no acknowledgment.

Key Features:

No handshake
No retransmission
No ordering
Very low overhead

Use Cases:

Live video streaming
Online gaming
VoIP (voice calls)
DNS queries

Why Use It:

Speed matters more than reliability
Small, fast messages
Tolerates occasional packet loss

📦 TCP (Transmission Control Protocol)

What it is:

A reliable, connection-oriented protocol
Ensures data arrives in order, without loss, and without duplication

Analogy:

Like sending packages with tracking and delivery confirmation. You get notified if something goes wrong.

Key Features:

3-way handshake

(SYN, SYN-ACK, ACK)

Retransmissions on loss
Ordered delivery
Flow & congestion control

Use Cases:

Web browsing (HTTP/HTTPS)
File transfers (FTP, SFTP)
Email (SMTP, IMAP)
Database communication

Why Use It:

Accuracy and reliability are critical
Data must arrive intact and in order
Works well for large payloads

🚀 QUIC (Quick UDP Internet Connections)

What it is:

A modern transport protocol built on UDP
Designed by Google to combine speed and reliability
Used in HTTP/3

Analogy:

Like express delivery with tracking — fast, secure, and reliable.

Key Features:

Built on UDP but adds reliability
Multiplexed streams

(no head-of-line blocking)

TLS encryption built-in
Faster connection setup

(0-RTT)

Use Cases:

Modern web traffic (HTTP/3)
Mobile apps
Real-time APIs
Streaming platforms

Why Use It:

Faster than TCP for web traffic
Secure by default
Handles packet loss gracefully

🧠 Comparison Table

ProtocolReliable?Ordered?Fast?Use Cases
UDP❌ No❌ No✅ YesGaming, VoIP, DNS, live video
TCP✅ Yes✅ Yes❌ SlowerWeb, file transfer, email, DBs
QUIC✅ Yes✅ Yes✅ YesHTTP/3, mobile apps, streaming

🌐 HTTP Versions & Transport Protocols

HTTP/1.1 (over TCP)

Each request opens a new TCP connection (unless keep-alive is used)
Every TCP connection requires a 3-way handshake: SYN → SYN-ACK → ACK
Only one request per connection at a time — even with pipelining, responses must come back in order
Head-of-line blocking: If one request is slow, others wait

Analogy:

Like a single-lane toll booth — every car (request) waits for the one ahead to finish.

HTTP/2 (over TCP)

One TCP connection per origin — handshake happens once
Multiplexing: multiple requests can be sent in parallel over one connection
Still suffers from TCP-level head-of-line blocking — if one packet is lost, all streams pause until it's retransmitted

Analogy:

Like a multi-lane toll booth — but if one lane drops a coin, all lanes pause until it's fixed.

HTTP/3 (over QUIC, built on UDP)

No TCP handshake — QUIC uses faster connection setup (0-RTT possible)
True multiplexing: each stream is independent — no head-of-line blocking
Built-in encryption (TLS 1.3) and reliability

Analogy:

Like a smart expressway — each lane moves independently, even if one hits a bump.

🔁 Summary Table

VersionTransportHandshake Per RequestParallel StreamsHead-of-Line Blocking
HTTP/1.1TCP✅ Yes (unless keep-alive)❌ No✅ Yes
HTTP/2TCP❌ Once per connection✅ Yes✅ Yes (TCP-level)
HTTP/3QUIC/UDP❌ Faster (0-RTT)✅ Yes❌ No

🔗 System Design Implications

UDP is great for speed-critical, loss-tolerant systems
TCP is ideal for correctness-critical systems
QUIC is the future of web transport — fast, secure, and reliable
HTTP/3 over QUIC eliminates head-of-line blocking for web applications

Design Tip: Choose based on what matters most:

Speed
→ UDP
Reliability
→ TCP
Both
→ QUIC

🎙️ Closing Thought

Transport protocols are the delivery trucks of the internet. UDP is fast but risky. TCP is safe but slower. QUIC is the best of both worlds. Understanding these protocols helps you choose the right tool for your system — whether you're building a chat app, a video platform, or a high-performance API.