From: Olivier Houchard Date: Thu, 17 Apr 2025 14:45:29 +0000 (+0200) Subject: MEDIUM: lb_fwrr: Don't start all thread groups on the same server. X-Git-Tag: v3.2-dev11~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=658eaa4086dccb999d4a9617da58b66974a79f83;p=thirdparty%2Fhaproxy.git MEDIUM: lb_fwrr: Don't start all thread groups on the same server. Now that all there is one tree per thread group, all thread groups will start on the same server. To prevent that, just insert the servers in a different order for each thread group. --- diff --git a/src/lb_fwrr.c b/src/lb_fwrr.c index 395895161..26fca7c4a 100644 --- a/src/lb_fwrr.c +++ b/src/lb_fwrr.c @@ -297,7 +297,7 @@ void fwrr_init_server_groups(struct proxy *p) { struct server *srv; struct eb_root init_head = EB_ROOT; - int i; + int i, j; p->lbprm.set_server_status_up = fwrr_set_server_status_up; p->lbprm.set_server_status_down = fwrr_set_server_status_down; @@ -334,7 +334,21 @@ void fwrr_init_server_groups(struct proxy *p) p->per_tgrp[i].lbprm.fwrr.bck.next = &p->per_tgrp[i].lbprm.fwrr.bck.t1; /* queue active and backup servers in two distinct groups */ + j = 0; for (srv = p->srv; srv; srv = srv->next) { + j++; + if (!srv_currently_usable(srv)) + continue; + if (j <= i) + continue; + fwrr_queue_by_weight((srv->flags & SRV_F_BACKUP) ? + p->per_tgrp[i].lbprm.fwrr.bck.init : + p->per_tgrp[i].lbprm.fwrr.act.init, + srv, i + 1); + } + j = 0; + for (srv = p->srv; srv && j < i; srv = srv->next) { + j++; if (!srv_currently_usable(srv)) continue; fwrr_queue_by_weight((srv->flags & SRV_F_BACKUP) ?