Skip to content

Commit 658eaa4

Browse files
Olivier Houcharda-denoyelle
authored andcommitted
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.
1 parent 3758eab commit 658eaa4

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/lb_fwrr.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void fwrr_init_server_groups(struct proxy *p)
297297
{
298298
struct server *srv;
299299
struct eb_root init_head = EB_ROOT;
300-
int i;
300+
int i, j;
301301

302302
p->lbprm.set_server_status_up = fwrr_set_server_status_up;
303303
p->lbprm.set_server_status_down = fwrr_set_server_status_down;
@@ -334,7 +334,21 @@ void fwrr_init_server_groups(struct proxy *p)
334334
p->per_tgrp[i].lbprm.fwrr.bck.next = &p->per_tgrp[i].lbprm.fwrr.bck.t1;
335335

336336
/* queue active and backup servers in two distinct groups */
337+
j = 0;
337338
for (srv = p->srv; srv; srv = srv->next) {
339+
j++;
340+
if (!srv_currently_usable(srv))
341+
continue;
342+
if (j <= i)
343+
continue;
344+
fwrr_queue_by_weight((srv->flags & SRV_F_BACKUP) ?
345+
p->per_tgrp[i].lbprm.fwrr.bck.init :
346+
p->per_tgrp[i].lbprm.fwrr.act.init,
347+
srv, i + 1);
348+
}
349+
j = 0;
350+
for (srv = p->srv; srv && j < i; srv = srv->next) {
351+
j++;
338352
if (!srv_currently_usable(srv))
339353
continue;
340354
fwrr_queue_by_weight((srv->flags & SRV_F_BACKUP) ?

0 commit comments

Comments
 (0)