Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the least loaded server

Given three servers which A , B , C in which A can handle 50% of the traffic , B can handle 30% of the traffic and C can handle 20% of the traffic come up with a formula to distribute load efficiently. The current load of the servers is also an input to the function.

I could not come up with the "formula" he is asking for. Is there any specific answer to this question ?

like image 454
Vinoth Kumar C M Avatar asked Jan 08 '12 04:01

Vinoth Kumar C M


People also ask

What is least connection load balancing?

Least connection load balancing is a dynamic load balancing algorithm where client requests are distributed to the application server with the least number of active connections at the time the client request is received.

Is Round Robin Load Balancing good?

Easy to implement and conceptualize, round robin is the most widely deployed load balancing algorithm. Using this method, client requests are routed to available servers on a cyclical basis. Round robin server load balancing works best when servers have roughly identical computing capabilities and storage capacity.

How can I get load balancing?

The most common method of a stateless load balancer is by making a hash of the IP address of the client down to a small number. The number is used for the balancer to decide which server to take the request. It also has the ability to pick a server entirely by random, or even go round-robin.


1 Answers

There are a few different ways to distribute load that might be applicable here.

Case 1. Random assignment biased proportionally to each servers load:

for each request
  let x = uniformly distributed random number between 0 and 1
  if x <= 0.5
    goto A
  else if x <= 0.8
    goto B
  else
    goto C

Case 2. Round-Robin biased proportionally to each servers load:

let x = new list
push A on x 5 times
push B on x 3 times
push C on x 2 times

for each request
  y = pop x
  goto y
  push y to back of x

Case 3. Forget about the supposed capacity and poll for current load

let La = A, load of A
let Lb = B, load of B
let Lc = C, load of C

goto argmin (La,Lb,Lc)
like image 161
JRideout Avatar answered Nov 02 '22 03:11

JRideout