# Trying to compute a balancing coefficient for evaluating load balancing in server farm

I tried to find a way to compute a coefficient varying from 0 to 1 where 0 mean perfect balance and 1 is the worst unbalance (all request go to one server).

Here a practical example... imagine a server farm with 3 server in it. In one day a got 9000 requests being served by those servers. Inside the farm, those 9000 calls get split between the 3 servers. Now, here's 2 scenario : the best case and worst case... best case : each server received 3000 calls so my coefficient will give me 0 (perfect balance). The worse case will be 9000 calls on only 1 server were my coefficient should compute to 1. Then you got all the possibility in between like... 4500 on server 1, 2250 on server 2 and 2250 on server 3 should get you 0.5 coefficient meaning only half the charge is well balance.

So I'm trying to find a formula (with no luck for now) that will compute this kind of coefficient so when put in a graphic in relation with the system load, could show me if my farm configuration is efficient or not by simply looking at this graph.

I want my formula to be adaptable (changing the number of server in farm) so I can simulate different scenario...

So anyone can point me in the right direction? :-)

-
How did you get $0.5$ in the "4500 on server 1, 2250 on server 2 and 2250 on server 3" case? Let $x=9000$, $y=3$, $x1=4500$, $x2=2250$, $x3=2250$, then what about $r=\max\{\left|\frac{x_i-x/3}{x/3}\right|\}$, in this case we would get $0.5$ –  Julius May 2 '12 at 15:37
By the way, I'm a BIG fan of StackExchange because you always get high quality answer at a breath taking speed!!! Thank you all! –  Steve S. May 2 '12 at 16:37

One option is to compute the variance of the proportional allocations. If the proportions (i.e. fraction of the total allocated to that server) going to the three servers are $S_1$, $S_2$ and $S_3$ then you have

$$M = \frac{S_1+S_2+S_3}{3}$$

$$V = \frac{(S_1-M)^2 + (S_2-M)^2 + (S_3-M)^2}{3}$$

In fact, $M$ will always be 1/3 here (you may like to try proving it) but I included it for completeness.

If the allocations are 1/3, 1/3 and 1/3 then $V=0$ (perfect balancing). If the allocations are 0, 0 and 1 then $V$ takes its maximum value. Work out what the maximum value is, and scale all values by it to get a number between 0 and 1.

You may also want to use the standard deviation instead of the variance, depending on what you need the number for (the standard deviation is the square root of the variance).

-

You could use the standard deviation of the number of requests handled by each server. The expression is under the section discrete random variable. If you calculate what it is for all requests going to one server, you can divide your actual standard deviation by that to get a scale from 0 to 1.

-
Your answer was also right but Chris answer was more "visual" ;-) Thanks anyway because 2 identical answer mean that the solution is near! –  Steve S. May 2 '12 at 16:35

A simple formula would be the difference between the number of tasks done by the busiest server and the number of tasks done by the least busy server, divided by the number of tasks in total.

-