Topic Overview

QUIC Protocol: Concepts, Internals & Interview Use Cases

Master QUIC protocol: UDP-based, encrypted, multiplexed transport for HTTP/3. Understand connection migration, zero-RTT, and improvements over TCP.

Medium11 min read

QUIC Protocol

Why This Matters

Think of QUIC like a faster, more reliable delivery service. Traditional delivery (TCP) requires multiple steps (handshake, then encryption setup), which is slow. QUIC combines everything into one step (encryption built-in, faster handshake), making delivery faster. QUIC is the foundation of HTTP/3, designed to improve web performance.

This matters because TCP has limitations: head-of-line blocking (one lost packet blocks all streams), slow handshake (2 round trips for TCP + TLS), and poor mobile performance (connection breaks on network changes). QUIC solves these: independent streams (no head-of-line blocking), faster handshake (0-1 round trip), and connection migration (survives network changes). Understanding QUIC helps you understand HTTP/3 and modern web performance.

In interviews, when someone asks "How would you optimize web performance?", they're testing whether you understand QUIC and HTTP/3. Do you know how QUIC improves upon TCP? Do you understand connection migration? Most engineers don't. They just use HTTP/2 and wonder why it's not faster.

What Engineers Usually Get Wrong

Most engineers think "QUIC is just faster TCP." But QUIC is a complete redesign. It runs over UDP (not TCP), has built-in encryption (TLS 1.3), supports multiplexing (multiple streams), and connection migration (survives IP changes). Understanding this helps you understand why QUIC is better for mobile and unreliable networks.

Engineers also don't understand that QUIC requires UDP support. Some networks block or throttle UDP, which breaks QUIC. Also, QUIC is relatively new (HTTP/3 is still being adopted), so not all clients/servers support it. Understanding this helps you understand QUIC adoption challenges.

How This Breaks Systems in the Real World

A service was using HTTP/2 over TCP. On unreliable networks (mobile, WiFi), TCP connections broke frequently, requiring reconnection and handshake. This added latency. The fix? Use HTTP/3 over QUIC. QUIC's connection migration survives network changes, and faster handshake reduces latency. This improves performance on mobile networks significantly.

Another story: A service was using QUIC but the network blocked UDP. QUIC couldn't establish connections. The service fell back to TCP, but this wasn't handled gracefully. The fix? Implement proper fallback. If QUIC fails, fall back to HTTP/2 over TCP. Or ensure UDP is allowed on the network. Understanding QUIC requirements helps you deploy it successfully.


What is QUIC?

QUIC provides:

  • UDP-based: Runs over UDP (not TCP)
  • Built-in encryption: TLS 1.3 integrated
  • Multiplexing: Multiple streams over single connection
  • Connection migration: Survives IP address changes
  • Faster handshake: 0-RTT or 1-RTT (vs 2-RTT for TCP+TLS)

Benefits over TCP:

  • No head-of-line blocking: Streams are independent
  • Faster connection: 0-RTT or 1-RTT handshake
  • Better mobile: Handles network changes better
  • Built-in security: Encryption by default

QUIC vs TCP

TCP Limitations

1. Head-of-Line Blocking

TCP Connection:
  Stream 1: [packet lost] → Blocks Stream 2, 3, 4...
  
All streams blocked until lost packet retransmitted

2. Slow Handshake

TCP: 3-way handshake (1.5 RTT)
TLS: 2-RTT handshake
Total: 3.5 RTT before data

3. Connection Migration

TCP: Connection tied to IP address
IP change: Connection breaks, must reconnect

QUIC Improvements

1. No Head-of-Line Blocking

QUIC Connection:
  Stream 1: [packet lost] → Only Stream 1 blocked
  Stream 2, 3, 4: Continue independently

2. Faster Handshake

QUIC: 0-RTT or 1-RTT handshake
TLS 1.3 integrated
Faster connection establishment

3. Connection Migration

QUIC: Connection survives IP changes
Connection ID: Identifies connection (not IP)
IP change: Connection continues

QUIC Features

1. Multiplexing

Multiple streams over single connection:

QUIC Connection:
  Stream 1: Request 1 → Response 1
  Stream 2: Request 2 → Response 2
  Stream 3: Request 3 → Response 3
  
All streams independent (no blocking)

2. Built-in Encryption

TLS 1.3 integrated:

QUIC Packet:
  [Header (encrypted)]
  [Payload (encrypted)]
  
No separate TLS handshake
Encryption by default

3. Connection Migration

Survives IP changes:

Connection ID: 0x1234
IP 1: 192.168.1.100
  → Network change
IP 2: 10.0.0.50
  
Connection continues (same Connection ID)

4. 0-RTT and 1-RTT

0-RTT (Resumed connection):

Client → Server: Data (with encrypted handshake)
Server → Client: Response

No round trip for handshake

1-RTT (New connection):

Client → Server: Initial (handshake)
Server → Client: Response (handshake complete)
Client → Server: Data

One round trip for handshake

QUIC Packet Structure

QUIC Packet:
  [Header]
    - Connection ID
    - Packet Number
    - Flags
  [Payload]
    - Stream Data
    - ACK
    - Crypto (TLS)

Key fields:

  • Connection ID: Identifies connection (not IP)
  • Packet Number: For ordering and reliability
  • Stream ID: Identifies stream
  • Encrypted: Header and payload encrypted

Examples

QUIC Connection

1// QUIC client (conceptual)
2import * as quic from 'quic';
3
4async function quicClient() {
5 // Create QUIC connection
6 const connection = await quic.connect({
7 host: 'example.com',
8 port: 443,
9 alpnProtocols: ['h3'] // HTTP/3
10 });
11
12 // Open stream
13 const stream = await connection.createStream();
14
15 // Send data (0-RTT or 1-RTT)
16 await stream.send(Buffer.from

HTTP/3 over QUIC

1// HTTP/3 uses QUIC
2import fetch from 'node-fetch';
3
4async function http3Client() {
5 // HTTP/3 request (uses QUIC)
6 const response = await fetch('https://example.com', {
7 method: 'GET',
8 // HTTP/3 support depends on fetch implementation
9 });
10 const text = await response.text();
11 console.log(text);
12}

Connection Migration

1class QUICConnection {
2 private connectionId: string;
3 private ipAddress: string | null = null;
4
5 constructor(connectionId: string) {
6 this.connectionId = connectionId;
7 }
8
9 async migrate(newIP: string): Promise<void> {
10 // Migrate connection to new IP
11 // Connection ID stays same
12 // Update IP address
13 this.ipAddress = newIP;
14
15 // Send migration packet
16 await this.sendMigrationPacketnewIP

Common Pitfalls

  • UDP blocking: Some firewalls block UDP. Fix: Ensure UDP port 443 is open
  • Not understanding connection migration: Assuming connection tied to IP. Fix: Use Connection ID, not IP
  • Expecting TCP semantics: QUIC is different from TCP. Fix: Understand QUIC's stream model
  • Not handling 0-RTT: Missing optimization. Fix: Implement 0-RTT for resumed connections
  • NAT traversal: UDP NAT issues. Fix: Use STUN/TURN if needed

Interview Questions

Beginner

Q: What is QUIC and how does it differ from TCP?

A:

QUIC (Quick UDP Internet Connections) is a transport protocol over UDP designed to improve upon TCP.

Differences:

FeatureTCPQUIC
TransportTCPUDP
EncryptionSeparate (TLS)Built-in (TLS 1.3)
Handshake3-RTT (TCP + TLS)0-RTT or 1-RTT
Head-of-line blockingYes (all streams)No (streams independent)
Connection migrationNo (tied to IP)Yes (Connection ID)

Key improvements:

  • No head-of-line blocking: Streams independent
  • Faster handshake: 0-RTT or 1-RTT
  • Built-in encryption: TLS 1.3 integrated
  • Connection migration: Survives IP changes

Example:

TCP: Stream 1 packet lost → All streams blocked
QUIC: Stream 1 packet lost → Only Stream 1 blocked

Intermediate

Q: Explain how QUIC eliminates head-of-line blocking and enables connection migration.

A:

Head-of-Line Blocking Elimination:

TCP Problem:

TCP Connection (single stream):
  Packet 1, 2, 3, 4, 5...
  Packet 2 lost → Blocks 3, 4, 5...
  
All data blocked until Packet 2 retransmitted

QUIC Solution:

QUIC Connection (multiple streams):
  Stream 1: Packet 1, 2, 3...
  Stream 2: Packet 1, 2, 3...
  Stream 3: Packet 1, 2, 3...
  
Stream 1 Packet 2 lost → Only Stream 1 blocked
Stream 2, 3 continue independently

How it works:

  • Multiple streams: Each stream has independent sequence numbers
  • Independent retransmission: Lost packet in one stream doesn't block others
  • UDP-based: No TCP ordering constraints

Connection Migration:

TCP Problem:

TCP Connection:
  Tied to: (Source IP, Source Port, Dest IP, Dest Port)
  IP change: Connection breaks, must reconnect

QUIC Solution:

QUIC Connection:
  Identified by: Connection ID (not IP)
  IP change: Connection continues (same Connection ID)

How it works:

  1. Connection ID: Unique identifier for connection
  2. IP change: Client sends packet with new IP, same Connection ID
  3. Server recognizes: Same Connection ID = same connection
  4. Connection continues: No reconnection needed

Example:

Mobile device:
  WiFi: 192.168.1.100 → Connection ID: 0x1234
  Switch to cellular: 10.0.0.50 → Connection ID: 0x1234 (same!)
  
Connection continues seamlessly

Senior

Q: Design a QUIC-based system that handles connection migration, handles network changes, and optimizes for mobile devices. How do you manage connection state and ensure reliability?

A:

1class QUICSystem {
2 private connections: Map<string, QUICConnection>;
3 private connectionManager: ConnectionManager;
4 private migrationHandler: MigrationHandler;
5
6 constructor() {
7 this.connections = new Map();
8 this.connectionManager = new ConnectionManager();
9 this.migrationHandler = new MigrationHandler();
10 }
11
12 // 1. Connection Management
13 class QUICConnection {
14 private connectionId:

Features:

  1. Connection migration: Handle IP changes seamlessly
  2. Stream management: Independent streams, no blocking
  3. Reliability: Per-stream ACK and retransmission
  4. 0-RTT: Resume connections for faster handshake
  5. Mobile optimization: Adaptive congestion, battery optimization

  • HTTP/1 vs HTTP/2 vs HTTP/3 - HTTP/3 is built on QUIC, understanding QUIC explains HTTP/3's advantages

  • TCP vs UDP - QUIC uses UDP as its transport, understanding UDP explains why QUIC avoids TCP limitations

  • Three-Way Handshake (TCP) - QUIC eliminates TCP handshake overhead, understanding TCP handshakes explains QUIC's performance benefits

  • TLS/SSL Handshake - QUIC integrates TLS 1.3 into the connection establishment, understanding TLS explains QUIC's built-in encryption

  • Connection Pooling - QUIC's connection migration reduces the need for connection pooling, understanding pooling helps appreciate QUIC's improvements

  • QUIC: UDP-based transport protocol with built-in encryption

  • No head-of-line blocking: Streams are independent, lost packet only blocks one stream

  • Faster handshake: 0-RTT (resumed) or 1-RTT (new) vs 3.5-RTT for TCP+TLS

  • Connection migration: Connection survives IP changes using Connection ID

  • Built-in encryption: TLS 1.3 integrated, encryption by default

  • Multiplexing: Multiple streams over single connection

  • HTTP/3: Uses QUIC as transport

  • Benefits: Better for mobile, faster connections, no TCP blocking

  • Best practices: Handle connection migration, optimize for mobile, use 0-RTT when possible

Key Takeaways

QUIC: UDP-based transport protocol with built-in encryption

No head-of-line blocking: Streams are independent, lost packet only blocks one stream

Faster handshake: 0-RTT (resumed) or 1-RTT (new) vs 3.5-RTT for TCP+TLS

Connection migration: Connection survives IP changes using Connection ID

Built-in encryption: TLS 1.3 integrated, encryption by default

Multiplexing: Multiple streams over single connection

HTTP/3: Uses QUIC as transport

Benefits: Better for mobile, faster connections, no TCP blocking

Best practices: Handle connection migration, optimize for mobile, use 0-RTT when possible


About the author

InterviewCrafted helps you master system design with patience. We believe in curiosity-led engineering, reflective writing, and designing systems that make future changes feel calm.