From 658eaa4086dccb999d4a9617da58b66974a79f83 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 17 Apr 2025 16:45:29 +0200 Subject: [PATCH] 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. --- src/lb_fwrr.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) ? -- 2.47.3