DEV Community

Sreekar Reddy
Sreekar Reddy

Posted on • Originally published at sreekarreddy.com

⚖️ Load Balancing Explained Like You're 5

Multiple checkout lanes at a store

Day 30 of 149

👉 Full deep-dive with code examples


The Bank Teller Analogy

Multiple tellers at a bank:

  • One teller → Long line, slow service
  • Five tellers → Shorter lines, faster service
  • Manager directs customers to available tellers

A Load Balancer directs traffic to available servers!


The Problem It Solves

One server has limits:

  • Can handle a limited number of requests
  • If it goes down, users may get delays or errors
  • Gets slow as traffic grows

How It Works

Traffic goes through the load balancer:

                    ┌─────────────────┐
Users ─────────────▶│  Load Balancer  │
                    └────────┬────────┘
                             │
            ┌────────────────┼────────────────┐
            ▼                ▼                ▼
       Server 1         Server 2         Server 3
Enter fullscreen mode Exit fullscreen mode

The load balancer decides which server handles each request.


Distribution Methods

Round Robin:

  • Request 1 → Server 1
  • Request 2 → Server 2
  • Request 3 → Server 3
  • Repeat!

Least Connections:

  • Send to server with fewest active requests
  • Better when some requests take longer

Geographic:

  • US users → US servers
  • European users → EU servers

Benefits

  • Handle more traffic → Multiple servers share load
  • High availability → One server down? Others still work
  • Scalability → Add more servers as needed
  • Better performance → Users hit less-busy servers

In One Sentence

Load Balancing distributes incoming traffic across multiple servers so no single server gets overwhelmed and your app stays fast and available.


🔗 Enjoying these? Follow for daily ELI5 explanations!

Making complex tech concepts simple, one day at a time.

Top comments (0)