* Julian Anastasov (ja@xxxxxx) [021101 13:11]:
>
> Hello,
>
> On Fri, 1 Nov 2002, Bradley McLean wrote:
>
> > In ip_vs_wlc.c starting around line 86 we have the meat of the
> > algorithm:
> >
> >
> > l = &svc->destinations;
> > for (e=l->next; e!=l; e=e->next) {
> > least = list_entry(e, struct ip_vs_dest, n_list);
> > if (atomic_read(&least->weight) > 0) {
> > loh = atomic_read(&least->activeconns) * 50
> > + atomic_read(&least->inactconns);
>
>
> Here least->weight > 0, say 5, loh 10
Agreed, loh is 10....
>
>
> > goto nextstage;
> > }
> > }
> > return NULL;
> >
> > /*
> > * Find the destination with the least load.
> > */
> > nextstage:
> > for (e=e->next; e!=l; e=e->next) {
> > dest = list_entry(e, struct ip_vs_dest, n_list);
> > doh = atomic_read(&dest->activeconns) * 50
> > + atomic_read(&dest->inactconns);
>
>
> 10 * dest->weight > doh * 5
>
> If dest->weight is 0 =>
> 10 * 0 > doh * 5
>
> Never happens. Yes?
I see I misread the lines below (mixed up dest and least), but
what the heck is the meaning of loh * dest->weight? Shouldn't
we be using loh with least and doh with dest?
" If the overhead of the least server times the weight of the
dest server is greater than the overhead of the dest server
times the weight of the least server, then make the dest server
the least server"
>
> > if (loh * atomic_read(&dest->weight) >
> > doh * atomic_read(&least->weight)) {
> > least = dest;
> > loh = doh;
> > }
> > }
> >
Rewrite:
if ( ( atomic_read(&dest->weight) > 0 ) &&
(loh * atomic_read(&least->weight) >
doh * atomic_read(&dest->weight)) ) {
least = dest;
loh = doh;
}
}
-Brad
|