AI Hints
Home›System Design Tutorial›Load Balancing
System Design · Lesson 25 of 120

Load Balancers

Spreading the work.

⏱ 2 min read▶ Video at 28:33🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Shoply now has thousands of users, and one web server isn't enough. We add three more. But how do users reach them? A load balancer sits in front, and spreads the requests across all the servers.

Load Balancers
From the video: Load Balancers
  • One server isn't enough
  • Add more servers
  • A load balancer spreads the work

Behind the balancer

Users connect to one address, the load balancer's. The balancer picks a healthy server for each request, and forwards it. The server answers through the balancer. Users never know how many servers there are, so we can add or remove them freely.

  1. Users
  2. Load balancer
  3. Server 1
  4. Server 2
  5. Server 3
Behind the balancer
From the video: Behind the balancer

What it gives us

A load balancer gives us three things. Scale, because we can add servers when traffic grows. Availability, because if one server dies, the balancer stops sending it traffic. And easy updates, because we can take servers out one at a time to upgrade them, with no downtime.

Scaleadd servers anytime
Availabilityskip dead servers
Easy updatesone server at a time
One addressusers never notice

Summary

A load balancer spreads requests across many servers, and skips the ones that fail. Next, how it decides which server gets each request.

Key takeaways
  • One address for users
  • Many servers behind
  • Failures are hidden
Next up: Balancing Algorithms — who gets the next request