In the last module, we learned how data travels in packets. But what happens when too many people want to read those packets at once?

If you have one server, and 1,000 people visit your site, that one server gets tired and eventually crashes. This is where Load Balancing comes in.


1. The Analogy: The Restaurant Host

Imagine a popular restaurant.

  • The Servers: The waiters in the kitchen.
  • The Customers: People coming in to eat.
  • The Load Balancer: The Host at the front door.

Without a host, everyone would crowd the first waiter they see, making that waiter stressed and slow, while other waiters might be standing around doing nothing.

The Load Balancer (Host) stands at the entrance and says: “You go to Table 1, You go to Table 2, You go to Table 3.”


2. Why Do We Need It?

A. High Availability (The ‘Spare’ Rule)

If you have only one waiter and they get sick, the restaurant closes. If you have five waiters and one gets sick, the restaurant stays open. The Load Balancer simply stops sending customers to the sick waiter.

B. Scalability (Growing the Team)

If your restaurant gets more popular, you don’t hunt for a “Super Waiter” who can carry 50 trays at once (Vertical Scaling). You just hire more waiters (Horizontal Scaling).


3. How Does the Host Choose?

The “Host” (Load Balancer) needs a plan to pick which waiter gets the next customer.

  1. Round Robin: Just go in order. Waiter 1, then 2, then 3, then 1 again. Simple and fair.
  2. Least Connections: Send the customer to the waiter who is currently serving the fewest people.
  3. IP Hash: Ensure that the same customer always goes to the same waiter (useful if the waiter already knows their “order”).

4. Where Does the Host Sit?

In System Design, the Load Balancer usually sits between the Users and the Web Servers.

graph LR
    U[Users] --> LB[Load Balancer]
    LB --> S1[Server A]
    LB --> S2[Server B]
    LB --> S3[Server C]

Beginner’s Checklist

  • Do I understand that a Load Balancer is just a “Director” of traffic?
  • Do I understand that adding more servers is better than making one server bigger?
  • Do I understand what happens if one server “dies”?

In the next chapter, we’ll dive into Intermediate Load Balancing, where we learn about “Layer 4 vs Layer 7” and how the Host actually talks to the waiters.