What is HTTP/2 and HTTP/3 and how do they improve performance?

Answer

HTTP/2 was the first major HTTP revision since 1997, bringing several performance improvements: Multiplexing: multiple requests share one TCP connection simultaneously — eliminates HTTP/1.1's "head-of-line blocking" where each connection could only handle one request at a time. This makes domain sharding and concatenation anti-patterns unnecessary. Header compression (HPACK): reduces repeated header overhead between requests on the same connection. Server push: server can proactively send resources before the client requests them (largely deprecated in practice). Binary protocol: more efficient parsing than HTTP/1.1's text protocol. HTTP/3: uses QUIC (UDP-based) instead of TCP: Eliminates TCP head-of-line blocking: packet loss on one stream doesn't block others (unlike HTTP/2 over TCP). Faster connection establishment: 0-RTT or 1-RTT instead of TCP's 2-RTT. Connection migration: connections survive IP address changes (switching from WiFi to cellular). HTTP/3 provides the most benefit for high-latency or lossy connections (mobile networks, CDN edges). Both are supported by all major browsers and most CDNs/servers.