Load Balancing verteilt den Datenverkehr für höhere Verfügbarkeit und Leistung.
L4 vs L7¶
- L4 — IP + Port, schnell, kennt den Inhalt nicht
- L7 — HTTP-Headers, URL, Cookies, intelligenter
Algorithmen¶
- Round Robin
- Least Connections
- IP Hash (Sticky)
- Weighted
- Random
Beispiele¶
Nginx L4¶
stream { upstream db { server 10.0.1.1:5432; server 10.0.1.2:5432; } server { listen 5432; proxy_pass db; } }
Nginx L7¶
upstream api { server 10.0.1.1:3000; server 10.0.1.2:3000; } server { location /api/ { proxy_pass http://api; } }
Tools¶
- HAProxy — L4/L7, populärster OSS
- Nginx — L7, L4 über Stream
- Traefik — Cloud-Native, Auto-Discovery
- Cloud LB — AWS ALB/NLB, Azure, GCP
L4 für Geschwindigkeit, L7 für Intelligenz¶
L4 für DB/TCP. L7 für HTTP-Routing und SSL-Terminierung.
load balancingl4l7