Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Take backend weight into account while calculating scheduler score

  • Loading branch information...
commit 5d90304b32e520b446ea372651c4718bebd581a2 1 parent 30ccaec
@gnosek authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 ngx_http_upstream_fair_module.c
View
11 ngx_http_upstream_fair_module.c
@@ -524,7 +524,18 @@ ngx_http_upstream_choose_fair_peer(ngx_peer_connection_t *pc,
if (i) {
prev_sched_score = sched_score;
}
+
sched_score = ngx_http_upstream_fair_sched_score(pc, &fsc, peer, n);
+
+ /*
+ * take peer weight into account
+ */
+ if (sched_score < 0) {
+ sched_score /= peer->current_weight;
+ } else {
+ sched_score *= peer->current_weight;
+ }
+
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, pc->log, 0, "[upstream_fair] pss = %i, ss = %i (n = %d)", prev_sched_score, sched_score, n);
if (sched_score <= prev_sched_score)

0 comments on commit 5d90304

Please sign in to comment.
Something went wrong with that request. Please try again.