Mailing List Archive

[mod_backhand-users] byLoad bias oddities
I've been playing with backhand all weekend, and it seems to be a
great system. However, I've noticed some wierdness in the bias
feature of the byLoad candidacy function.

The FAQ states that the bias is "the amount of load subtracted from
your load before you sort the servers". However, the code for
_load_compare (the function called by byLoad to sort the servers, in
builtins.c) appears to *add* the bias to my load rather than subtract
it. In the following snippet, personalpreference contains the byLoad
bias.

[snip]
aload = (float)serverstats[a].load;
aload += (a)?0:personalpreference;
aload *= adj/(float)serverstats[a].arriba;
bload = (float)serverstats[b].load;
bload += (b)?0:personalpreference;
bload *= adj/(float)serverstats[b].arriba;
[snip]

As you can see, personalpreference is *added* rather than subtracted
from the load before sorting.

Furthermore, it appears that the values being compared are actually
1000*LOAD where LOAD is what we usually think of when we speak of
load. This is demonstrated by the output of following line I
temporarilly added to _load_compare:

ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, NULL,
"aload:%f bload:%f pp:%f", aload, bload, personalpreference);

Which puts this in my error_log:

[notice] aload:198.647125 bload:110.000000 pp:1.000000

Where the load on my machines was in the 0.1 to 0.2 range

The FAQ makes it seem like 'byLoad 1' will subtract 1 from my load and
then sort... I've found that in order to get this behavior I actually
need 'byLoad -1000'

I'd recommend changing the FAQ to explain this, or modify the code to
subtract 1000*bias (which would make more sense).

-Blake
p.s. RH6.2, Apache-1.3.12