Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/Load Balancing & Proxies
FUNDAMENTALS & NETWORKING · SUBTOPIC

Load Balancing Algorithms & Health Checks

Round Robin, Weighted, Least Connections, and active/passive health checks.

BeginnerPart of Load Balancing & Proxies
Practice in AI HLD
Subtopics in Load Balancing & Proxies (2)
OverviewL4 vs. L7Routing Algorithms

In plain words

How does the host pick the next table? Either take turns (Round Robin), pick the waiter with the fewest active tables (Least Connections), or give bigger tables more guests (Weighted).

Think of it like…

Supermarket lines: "take turns" fails when one customer has 200 items; picking the shortest active line keeps everyone moving.

Loading interactive diagram
Loading interactive exercise

Theory & how it works

Why Least Connections beats Round Robin for real APIs

If request #1 is a heavy PDF export taking 5 seconds and request #2 is a 5 ms health ping, Round Robin blindly keeps sending every 3rd request to the busy server holding slow exports. Least Connections naturally routes around busy nodes.

Add Power of Two Choices (P2C): pick two random servers and send the request to whichever has fewer active connections. It is fast, decentralized, and avoids herd effects.

Key points & practical guide

Summary checklist

  • Round Robin for identical fast requests
  • Least Connections for mixed/long-running requests
  • Active health checks (/healthz) + graceful draining on shutdown

When to use it

  • Any multi-node backend service pool

Watch out for

  • Letting health checks query a heavy DB endpoint - keep /healthz lightweight or use /readyz separately

Quick check

Loading quiz
Previous subtopic
Layer 4 vs. Layer 7 Load Balancing
Back to overview
Full Load Balancing & Proxies Lesson