From 747ff09818996bdc3667ceb8d2a11c367095e869 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Mon, 16 Feb 2026 16:12:15 +0100 Subject: [PATCH] MEDIUM: backend: make "balance random" consider tg local req rate when loads are equal This is a follow up to b6bdb2553 ("MEDIUM: backend: make "balance random" consider req rate when loads are equal") In the above patch, we used the global sess_per_sec metric to choose which server we should be using. But the original intent was to use the per thread group statistic. No backport needed, the previous patch already improved the situation in 3.3, so let's not take the risk of breaking that. --- src/backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend.c b/src/backend.c index b531843fc..abe3942d3 100644 --- a/src/backend.c +++ b/src/backend.c @@ -585,8 +585,8 @@ struct server *get_server_rnd(struct stream *s, const struct server *avoid) curr = prev; else if (wcurr == wprev && curr->counters.shared.tg && prev->counters.shared.tg) { /* same load: pick the lowest weighted request rate */ - wcurr = read_freq_ctr_period_estimate(&curr->counters._sess_per_sec, MS_TO_TICKS(1000)); - wprev = read_freq_ctr_period_estimate(&prev->counters._sess_per_sec, MS_TO_TICKS(1000)); + wcurr = read_freq_ctr_period_estimate(&curr->counters.shared.tg[tgid - 1]->sess_per_sec, MS_TO_TICKS(1000)); + wprev = read_freq_ctr_period_estimate(&prev->counters.shared.tg[tgid - 1]->sess_per_sec, MS_TO_TICKS(1000)); if (wprev * curr->cur_eweight < wcurr * prev->cur_eweight) curr = prev; } -- 2.47.3