Course contentsShow
← System Design
Lesson 91 of 1,9193. Load BalancingFree lesson

Random Selection Algorithm

Chooses server randomly for each request, statistically achieving even distribution at scale.

Random Selection Algorithm

What you'll learn: How a load balancer can pick servers by rolling the dice—simple, fast, and surprisingly fair at scale.

The Core Idea

The random selection algorithm is perhaps the simplest load balancing strategy: for each incoming request, the load balancer randomly picks one server from the pool. Think of it like drawing names from a hat—every server has an equal chance of being chosen, and you repeat this process independently for every request.

Unlike Round Robin (which follows a predictable pattern) or Least Connections (which requires tracking state), random selection requires no memory of past decisions and no knowledge of current server load. It's purely probabilistic.

How It Works

When a request arrives, the load balancer:

  1. Generates a random number
  2. Maps that number to one of the available servers
  3. Forwards the request immediately

For example, with 5 servers, you might generate a random number between 0-4 and route to that server index.

Why It Works at Scale

The magic happens through the law of large numbers. While individual requests are unpredictable, across thousands or millions of requests, the random distribution approaches an even split. If you flip a coin 10 times, you might get 7 heads—but flip it 10,000 times and you'll get close to 5,000 heads.

This makes random selection statistically equivalent to Round Robin over time, but without the coordination overhead. It's particularly useful when servers are identical and you want minimal load balancer complexity.

Limitations

Random selection doesn't account for server capacity differences or current load, so it works best with homogeneous servers and relatively uniform request patterns.

Key Takeaway: Random selection achieves fair load distribution through probability—dead simple to implement, no state required, and surprisingly effective when you have enough traffic volume.