An Empirical Study of Load Balancing Algorithms

What is Round Robin?

It's one of the simplest if not the simplest load balancing algorithm. It distribute requests by walking the list of servers and assigning a request to each server in turn. On the downside, it assumes that all requests take the same amount of time, which is obviously not true in practice.

Client Example

An example of the code used by the client to assign requests to servers, using liblb/r2 Go package, which implements Round Robin.

// define a round-robin load balancer
lb := r2.New("127.0.0.1:8009", "127.0.0.1:8008", "127.0.0.1:8007")

for i := 0; i < 10; i++ {
    // picks one of the hosts, sequentially
    host, err := lb.Balance()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Send request #%d to host %s\n", i, host)
}

Experiment Results

liblb simulation architecture liblb simulation architecture liblb simulation architecture
Round Robin's Experiment Results
For info on the graphs

Strengths

  • Uniform load distribution.
  • Good choice when you're not sure about your load balancing requirements.
  • Easy to reason about, it simplifies capacity planning when you don't have enough real data.
  • Implemented in most load balancers.

Weaknesses

  • Oblivious to the actual load of the servers when it assigns requests to, because it assumes that all requests take the same time.
  • It has no way of assigning certain requests to certain servers (affinity), which makes it not suitable for systems that utilizes caches to minimize heavy computations.

Use Cases

  • Three Tier Applications, most websites basically.
  • Stateless Applications, for example an uptime service that checks if a certain server up or not by sending a request to (isup.me)

liblb R2 Balancer API docs

GoDoc liblb/r2