HTTP/3 and QUIC
HTTP/3 (RFC 9114, 2022) uses QUIC (Quick UDP Internet Connections) instead of TCP, eliminating TCP-level head-of-line blocking.
The Problem HTTP/3 Solves
HTTP/2 over TCP:
TCP Connection
├── Stream 1: [===][===][===]
├── Stream 2: [===][===][===]
└── Stream 3: [===][===][===]
If Stream 2's TCP packet is lost:
ALL streams are blocked (TCP HOL blocking)
HTTP/3 over QUIC (UDP):
QUIC Connection
├── Stream 1: [===][===][===]
├── Stream 2: [===][===][===] ← Lost packet only affects this stream
└── Stream 3: [===][===][===]
Only Stream 2 is affected — others continue
QUIC vs TCP
| Feature | TCP | QUIC |
|---|---|---|
| Transport | TCP | UDP |
| TLS | Separate (TLS over TCP) | Built-in (1-RTT handshake) |
| HOL Blocking | Yes (TCP level) | No (per-stream) |
| Connection Migration | No (IP+port) | Yes (connection ID) |
| Congestion Control | Kernel space | User space (pluggable) |
QUIC Handshake
TCP + TLS 1.3:
Client Server
|---SYN----->| 1 RTT
|<-SYN-ACK---| (TCP)
|---ACK----->|
|---TLS----->| 2 RTT
|<-TLS-------| (TLS)
|---App Data->|
QUIC (0-RTT):
Client Server
|---Initial--->| 0-RTT
|<-Initial-----| (Combined
|---App Data-->| TCP+TLS)
Connection Migration
TCP: Connection tied to IP:Port
Phone on WiFi: 192.168.1.100:54321 → Server
Phone switches to 4G: 10.0.0.50:12345 → NEW connection needed!
QUIC: Connection identified by Connection ID
Phone on WiFi: Connection-ID: abc → Server
Phone switches to 4G: Connection-ID: abc → SAME connection!
HTTP/3 Benefits
- No TCP HOL blocking — Lost packets only affect one stream
- Faster handshakes — 0-RTT or 1-RTT vs 2-3 RTT for TCP+TLS
- Connection migration — Seamless network switches
- Improved loss recovery — Per-stream flow control
HTTP Best Practices
Methods
- GET: Read (safe, idempotent)
- POST: Create
- PUT: Replace (idempotent)
- PATCH: Partial update
- DELETE: Remove (idempotent)
Headers
- Content-Type: Body format
- Cache-Control: Caching rules
- Authorization: Authentication
- Accept: Desired response format
Status Codes
- 2xx: Success
- 3xx: Redirection
- 4xx: Client error
- 5xx: Server error
Key Points
- Understanding HTTP/3 Basics is essential for production systems
- Always consider scalability and maintainability
- Test thoroughly before deploying to production
- Monitor performance and set up alerting
Common Patterns
- Validation: Always validate input at the boundary
- Error Handling: Use structured error responses
- Logging: Log key events for debugging
- Testing: Unit, integration, and load tests
- Documentation: Keep docs updated with code changes
Practice Problems
Design and implement a solution for HTTP/3 Basics in a backend system. Consider scalability, error handling, and production readiness.
Solution
// HTTP/3 Basics implementation
// Key aspects: validation, error handling, logging, testing
public class HTTP3Basics {
// Production-ready implementation
}Identify and handle edge cases for HTTP/3 Basics. What happens under high load, with invalid input, or during failures?
Solution
// Edge case handling:
// 1. Null/empty input -> validation
// 2. High load -> rate limiting, queuing
// 3. Failures -> retries, circuit breaker
// 4. Concurrent access -> locks, idempotencyWrite a testing strategy for HTTP/3 Basics. Include unit tests, integration tests, and performance tests.
Solution
// Test plan:
// - Unit: 80% coverage target
// - Integration: API contracts
// - Performance: latency, throughput
// - Chaos: failure injectionQuiz
1. What transport protocol does HTTP/3 use instead of TCP?
2. What is the main advantage of QUIC over TCP+TLS?
3. What is the primary purpose of HTTP/3 Basics?
4. What is a common mistake when implementing HTTP/3 Basics?
Flashcards
Question
What is HTTP/3?
Click to reveal answer
Answer
HTTP over QUIC (UDP) — eliminates TCP head-of-line blocking
Question
What is QUIC?
Click to reveal answer
Answer
Quick UDP Internet Connections — UDP-based transport with built-in TLS
Question
What is HTTP/3 Basics?
Click to reveal answer
Answer
HTTP/3 Basics is a key concept in backend development.
Question
When to use HTTP/3 Basics?
Click to reveal answer
Answer
Use HTTP/3 Basics when building production systems that require reliability, scalability, and maintainability.
Question
HTTP/3 Basics best practices
Click to reveal answer
Answer
Follow SOLID principles, write clean code, test thoroughly, document decisions, and monitor in production.
Revision Notes
Key Takeaways
- 1.HTTP/3 runs over QUIC (UDP), not TCP
- 2.Eliminates TCP head-of-line blocking
- 3.QUIC combines transport + TLS handshake (0-RTT)
- 4.Connection migration enables seamless network switches
Interview Tips
- •Know the difference between HTTP/2 and HTTP/3
- •Understand why QUIC uses UDP instead of TCP
Cheat Sheet
HTTP/3
- Transport: QUIC (UDP)
- vs HTTP/2: No TCP HOL blocking
- Handshake: 0-RTT or 1-RTT (combined TCP+TLS)
- Migration: Seamless network switches
- Status: Supported by Chrome, Firefox, Cloudflare