API Protocols — HTTP/1.1 vs. HTTP/2 vs. HTTP/3 (QUIC) vs. gRPC
The Single Multiplexed TCP Pipe That Stalled 500 RPCs
Test your architecture intuition: Pitch a 7-axis solution, survive two aggressive reviewer objections, and inspect the staff-level Teacher Gold Answer.
1. What It Is & Why It Exists
The Core Problem: Network Inefficiency & Head-of-Line Blocking
In modern distributed systems and web architectures, network transport efficiency directly dictates user perceived latency, server thread utilization, and bandwidth costs:
- HTTP/1.1 Inefficiencies: Textual wire format with verbose, uncompressed headers. Concurrency requires opening multiple TCP connections (browsers open up to 6 per origin). Suffers from Application-Layer Head-of-Line (HOL) Blocking—a slow request blocks all subsequent requests on that TCP connection.
- HTTP/2 Breakthroughs & Transport HOL: Introduced binary framing, stream multiplexing over a single TCP connection, and HPACK header compression. However, because it runs on single-stream TCP, a single lost packet blocks all multiplexed streams until TCP retransmits and reorders the packet (Transport-Layer HOL Blocking).
- HTTP/3 & QUIC (UDP): Eliminates Transport HOL blocking by running over UDP. Each multiplexed stream is independent. Combines the transport handshake and TLS 1.3 cryptographic handshake into a single roundtrip ( or connection resumption) and provides native Connection Migration across network switches (e.g., Wi-Fi to 5G cellular).
- gRPC & Protocol Buffers: High-performance, strongly-typed Remote Procedure Call (RPC) framework built on HTTP/2 transport (some implementations also support HTTP/3) using Protobuf binary serialization, bi-directional streaming, and client/server code generation.
Synthesizing vector architecture diagram...
2. Core Mechanics & Wire Protocol Comparison
Synthesizing vector architecture diagram...
Start at the top: the same payload is split into three streams, then sent down two different transports. In the "HTTP/2 over TCP" panel, all three streams share one TCP connection; TCP must deliver bytes in order, so when packet 2 is lost, packets for streams 1 and 3 that arrive after it are held in the buffer until packet 2 is resent, and every stream stalls. In the "HTTP/3 over QUIC" panel, each stream has its own ordering on top of UDP, so streams 1 and 3 are delivered at once and only stream 2 waits for its retransmission. This is head-of-line blocking: HTTP/2 removed it at the HTTP level but still suffers it at the TCP level, which hurts most on lossy mobile networks.
Comprehensive Protocol Comparison Matrix
| Feature | HTTP/1.1 | HTTP/2 | HTTP/3 (QUIC) | gRPC (over H2/H3) | WebSocket |
|---|---|---|---|---|---|
| Underlying Transport | TCP | TCP | UDP (QUIC) | TCP / UDP | TCP |
| Wire Format | Text / ASCII | Binary Frames | Binary Frames | Protocol Buffers (Binary) | Binary / Text Frames |
| Multiplexing | No (Pipelining flawed) | Yes (Single TCP) | Yes (Independent UDP) | Yes (Multiplexed RPCs) | Full Duplex Stream |
| HOL Blocking | Application Layer | Transport (TCP) Layer | None across streams (a loss stalls only its own stream) | None across streams (on H3) / TCP (on H2) | TCP (one ordered stream) |
| Header Compression | None | HPACK (Static/Dynamic table) | QPACK (Out-of-order) | HPACK / QPACK | None (2-14 byte frame header) |
| Handshake Latency | (TCP + TLS) | (TCP + TLS) | (QUIC + TLS 1.3) | (Fast reuse) | (TCP + TLS + HTTP Upgrade) |
| Connection Migration | No (Breaks on IP change) | No (Breaks on IP change) | Yes (variable-length Connection ID, up to 20 bytes) | No (Depends on transport) | No |
| Streaming Support | Chunked Transfer | Streams (Server Push is deprecated in browsers) | Independent Streams | Unary, Client, Server, Bi-di | Full Duplex Bi-directional |
| Primary Use Case | Legacy Web / Simple APIs | Modern Web Ingress | Mobile Browsing, Video, CDN | Internal Microservices RPC | Real-time Chat, Live Feeds |
Unlock Complete Architecture & Production Runbooks
You have explored the free architectural preview (~46%). Spend 1 Coin to unlock the remaining 5 production deep-dive sections for a full 24 hours.