Round Robin Load Balancing

Say your app got popular overnight. One server can’t handle all the traffic anymore, so you add a few more. Now you’ve got a new question.

  • You have, let’s say, three servers sitting ready.
  • A flood of requests is coming in from users.
  • Somebody has to decide which request goes to which server, right?

That somebody is the load balancer, the piece in front of your servers that hands out the incoming traffic. And the simplest way it can share that traffic is an algorithm called round robin. Let’s see exactly how it works.

🔁 What is Round Robin?

Round robin is the most basic way to spread requests across servers. Here’s the idea in one line.

  • The load balancer sends each new request to the next server in turn, and when it reaches the last server, it loops back to the first one.
  • That’s it. It just goes around the circle, one server at a time, over and over.
  • Think of it like dealing cards. You don’t give all the cards to one player, right? You go one card to each person, around the table, then start again from the first.

So with three servers, the very first request goes to Server 1, the next to Server 2, the next to Server 3, and then the fourth request comes back around to Server 1. Here’s that rotation as a picture.

request 1

request 2

request 3

request 4 (loops back)

Load Balancer

Server 1

Server 2

Server 3

And here’s the same thing as a table, so you can see the pattern clearly.

Request number Goes to server
Request 1 Server 1
Request 2 Server 2
Request 3 Server 3
Request 4 Server 1 (back to the start)
Request 5 Server 2

See the loop? After Server 3, it just starts over from Server 1. The load balancer doesn’t ask any questions, it just keeps the rotation going.

⚖️ Weighted Round Robin

Plain round robin treats every server the same. But what if your servers aren’t the same? Maybe one is a beefy machine and another is a small one. That’s where the weighted version comes in.

  • Weighted round robin lets you give each server a weight, which is just a number that says how big a share of traffic it should get.
  • A stronger server gets a higher weight, so it receives more requests in each cycle.
  • A weaker server gets a lower weight, so it receives fewer.

Let’s make it concrete. Say Server 1 is powerful and you give it a weight of 3, while Server 2 is small and gets a weight of 1.

  • Out of every four requests, three go to Server 1 and one goes to Server 2.
  • So the rotation might look like: Server 1, Server 1, Server 1, Server 2, then back to the start.
  • The big server pulls more weight, the small one isn’t overloaded, and everyone stays happy.

When weighted helps

Use weighted round robin when your servers have different capacity. If they’re all the same size, plain round robin is enough and there’s no reason to bother with weights.

Round robin shows up everywhere as a default, and there are good reasons for that.

  • It’s dead simple. The logic is just “send to the next one, then loop”. You can explain it in a single sentence, and it’s easy to build.
  • It keeps no state. The load balancer doesn’t have to track how busy each server is or remember anything about past requests. It just counts to the next slot.
  • It spreads load evenly when your servers are similar. If every server is the same size and every request takes about the same effort, traffic gets shared nice and fairly.

So for a lot of everyday setups, where the servers match and the requests are roughly equal, round robin just works. No fuss.

⚠️ Where It Falls Short

Now here’s the catch, and this is the part interviewers love to dig into. Round robin makes one big assumption.

  • It assumes all servers and all requests are equal. It doesn’t actually look at any of them.
  • But requests are not equal. One request might be a quick “show the homepage”, and another might be a heavy “generate this giant report”.
  • Imagine the heavy requests keep landing on the same server by the luck of the rotation. That server gets buried while the others sit half-idle.

And the deeper problem is this.

  • Round robin doesn’t know the current load on any server. It can’t tell that Server 2 is already drowning.
  • It’ll happily send the next request to Server 2 anyway, just because it’s Server 2’s turn.
  • So a slow or struggling server keeps getting fed, even when it’s the last one that should.

That’s the trade-off for being so simple. It’s blind. It counts turns, not actual work.

🧩 When to Use It

So when should you reach for round robin, and when should you look elsewhere?

  • Reach for it when your servers are similar in size and your requests cost about the same. That’s its sweet spot, simple and effective.
  • If servers differ in power, use weighted round robin instead, so the bigger ones carry more.
  • But if request costs vary a lot, or some requests run long while others are quick, round robin starts to struggle. In that case, consider an algorithm like least connections, which sends each request to whichever server is handling the fewest right now.

The rule of thumb is easy. Equal servers and equal requests, round robin is great. The more uneven things get, the more you’ll want something smarter.

⚠️ Common Mistakes and Misconceptions

A couple of things trip people up with round robin. Let’s clear them out.

  • “Round robin balances actual load.” No, it doesn’t. It only counts in turn. It has no idea how busy any server actually is, it just hands out requests one after another.
  • “It accounts for server power.” Plain round robin treats every server the same. Only the weighted version knows about server strength, and only because you told it the weights yourself.
  • “Even traffic means even load.” Sending the same number of requests to each server isn’t the same as giving each server the same amount of work. A few heavy requests can tip the balance fast.

🛠️ Design Challenge

Try this one on your own to test yourself.

You’re running four servers behind a round robin load balancer. Three of them are equal-sized, but one is twice as powerful as the rest.

  • First, explain what goes wrong if you use plain round robin here.
  • Then, pick weights for each server so the powerful one gets a fair share of the extra traffic.
  • Finally, describe one kind of request pattern that would make even weighted round robin a poor fit, and say what you’d switch to.

Work through it out loud, the way you would in an interview. That’s exactly the reasoning they want to see.

🧩 What You’ve Learned

You can now explain how the simplest load balancing algorithm works. Here’s what you’ve picked up.

  • ✅ Round robin sends each request to the next server in turn, then loops back to the start.
  • ✅ Weighted round robin gives stronger servers a bigger share by assigning weights.
  • ✅ It’s popular because it’s simple, stateless, and spreads load evenly across similar servers.
  • ✅ It falls short because it ignores real-time load and assumes all servers and requests are equal.
  • ✅ Use it for similar servers and similar request costs, and reach for least connections when load is uneven.

Check Your Knowledge

Test what you learned. Pick an answer for each question, then click Check.

  1. 1

    How does round robin pick a server for each request?

    Why: Round robin simply rotates through the servers in order and starts over after the last one.

  2. 2

    Does round robin look at how busy each server is?

    Why: Round robin is stateless and blind to load, so it keeps handing out requests in rotation no matter how busy a server is.

  3. 3

    What does weighted round robin add?

    Why: Weighted round robin assigns each server a weight so more powerful machines receive more requests per cycle.

  4. 4

    What is a good alternative when request costs vary a lot?

    Why: Least connections sends each request to the least busy server, so it handles uneven request costs better than round robin.

🚀 What’s Next?

Round robin is your starting point for load balancing. From here, you can go deeper into smarter algorithms and the bigger picture.

Once you’ve got those, you’ll know not just how to share traffic, but how to share it intelligently.

Share & Connect