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
> 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?
> if (loh * atomic_read(&dest->weight) >
> doh * atomic_read(&least->weight)) {
> least = dest;
> loh = doh;
> }
> }
>
> Unless the linked list is sorted by weight, I think this fails
No, it is not sorted
> if you have a real server with a nonzero weight, followed by
> one with a zero wait - it selects the zero weight server.
>
> The second for loop needs a test to eliminate zero weights.
>
> Yes?
No
> -Brad
Regards
--
Julian Anastasov <ja@xxxxxx>
|