Wiki: Let’s Build a Load Balancer
For agents: Markdown version · Wiki index · Explore
- Speaker: Amir Hadadi
- Event: Reversim Summit 2021
- Video: https://www.youtube.com/watch?v=Fi-jIiI6IM0
- Transcript: /transcripts/2021/12-Fi-jIiI6IM0.md
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: Scalability, Distributed Systems, Infrastructure, Performance
Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.
Summary
The speaker shares insights on load balancing derived from real-world scaling challenges encountered during a Kubernetes migration. The talk examines how basic algorithms like Round Robin fail when dealing with heterogeneous hardware and varying capacities. It introduces advanced concepts such as the Power of Two Choices to solve scaling and thundering herd problems. Finally, the speaker highlights potential pitfalls where sophisticated load balancers inadvertently exacerbate production incidents.
Key points
- 0:11 Moving to Kubernetes introduced heterogeneous hardware and noisy neighbor issues, leading to production incidents.
- 4:15 A load balancer sits between the internet and the system, handling tasks like service discovery, SSL termination, and session stickiness.
- 7:11 Load balancing decisions happen constantly throughout internal microservice topologies, not just at the network edge.
- 7:11 Round Robin is simple and lightweight, ensuring equal traffic distribution when all servers have identical capacity.
- 11:15 Round Robin struggles when servers have different capacities or performance profiles due to mixed hardware.
- 13:14 The thundering herd problem occurs when a newly added warm-up server gets instantly flooded with requests and crashes.
- 14:19 The Power of Two Choices algorithm randomly picks two servers and routes traffic to the better one, solving both scaling and herd issues.
- 18:54 Load balancers can unintentionally amplify failures by routing excessive traffic to a degraded server that is returning fast fallback responses.
Takeaways
- Audit your current gateway and internal load balancing algorithms, as default options like Round Robin may not suit heterogeneous hardware.
- Adopt the Power of Two Choices approach to avoid scalability bottlenecks and thundering herd problems when routing traffic.
- Ensure your load balancer metrics align with your backend service health metrics to prevent overloading degraded instances.
Questions this talk answers
- Why does the Round Robin load balancing algorithm fail in environments with heterogeneous hardware?
- How does the Power of Two Choices algorithm solve the thundering herd problem?
- What risks are introduced when a load balancer routes more traffic to a fast-responding degraded instance?
Technologies
Kubernetes, PagerDuty
Tags
distributed systems, kubernetes, latency, load balancing, reliability, scalability