Wouldn't you just rotate the mailservers? Go from A to B to C instead of
picking one randomly? I don't see how random distribution is going to be less
balanced than a simple round-robin, and generating random numbers tends to take
more computation than incrementing a variable.
"Austad, Jay" wrote:
> Instead of having qmqpc picking the first available server, I would like it
> to load balance between all servers I have listed as QMQP servers. In
> qmail-qmqpc.c on line 153, it says:
> i = 0;
> for (j = 0;j < servers.len;++j)
> if (!servers.s[j]) {
> doit(servers.s + i);
> i = j + 1;
> }
>
> Would it work if I change it to:
> i = 0;
> for (j = 0;j < servers.len;++j)
> i = (servers.len*1.0)*rand()/(RAND_MAX+1.0);
> if (!servers.s[j]) {
> doit(servers.s + i);
> }
>
> This way, "i" will be a random number from 0 to (servers.len-1).
>
> ----------
> Jay Austad
> Network Administrator
> CBS Marketwatch
> 612.817.1271
> [EMAIL PROTECTED]
> http://cbs.marketwatch.com
> http://www.bigcharts.com