Again, its unnecessary and does not add anything to the 'system' of
distributing load across servers.  Distributing in a true round-robin
fashion is sufficient if the servers are of equal quality (and/or drop
connections sooner if they are not).  True round-robin distribution cannot
easily be accomplished (without shared memory or a temporary file) and so
picking a random starting point is the closest that can be achieved.  Using
random servers each time though, especially from a near-true random number
source, could cause one server to be hit 3 or 4 (or, technically, an
infinite number of) times in a row.  There is no need to go to the expense
of randomly computing each successive server (for example:)

#1 #2 #3 #4 #5
1   3   4   1   2
2   4   1   2   3
3   1   3       4
4       4       1
1               2

"1,3,4,1,2" were picked as my random numbers and the number of messages sent
out in a round varying ... each server was hit almost evenly:

1 xxxxxx
2 xxxxx
3 xxxx
4 xxxxx

(Disclaimer: My old stats teacher would kill me for this insufficiently long
example and lack of mathematical proof)

----- Original Message -----
> A small modification to what you have done can get rid of the problem of
> banging one server. Instead of just sampling a random starting point for
> the search, just get a random number between 1 and N (N being the number
> servers) and if that server is down just sample again until you find a
> server that's up. This way, you will redistribute the load randomly to all
> servers and not just the next one on the list.

Reply via email to