Compare

Side-by-side on the decisions that recur: TCP vs UDP, HTTP/2 vs HTTP/3, flow vs congestion control, L4 vs L7, forward vs reverse proxy, IPv4 vs IPv6 — with when to choose each.

L4 load balancingL7 load balancing
SeesIP addresses and TCP/UDP portsHTTP: method, path, headers, cookies
Decision granularityPer connectionPer request — many requests on one connection can go to different backends
TLSPassed through; the backend terminates itUsually terminated here; backend traffic may be plain or re-encrypted
Routing rulesHash of 5-tuple, round robin, least connectionsPath prefix, host header, header value, weighted canaries
Cost per byteVery low; can run in the kernel or on hardwareHigher: parses and re-serialises every request
Client IP at the backendPreserved (DSR / NAT modes vary)Lost unless X-Forwarded-For or PROXY protocol
Health checkCan the port accept a TCP connection?Does GET /healthz return 200?
Choose this whenNon-HTTP traffic, very high throughput, or when backends must terminate TLS themselves.Path- or header-based routing, canaries, sticky sessions by cookie, TLS offload, and HTTP-aware retries.