Permalink
Browse files

Tweak scheduler score

Now the time since last activity is "positive", i.e. the bigger the time,
the greater chance of selecting this backend.

The point of this change is to keep scheduler scores roughly decreasing in
round-robin order, and to keep the iteration count of the main loop of
ngx_http_upstream_choose_fair_peer as short as possible.
  • Loading branch information...
1 parent 9c25ccd commit 33c3bc2a42cae89ad36d2bf6b24a6c3af89cdc5a @gnosek committed Nov 11, 2007
Showing with 1 addition and 1 deletion.
  1. +1 −1 ngx_http_upstream_fair_module.c
@@ -230,7 +230,7 @@ ngx_http_upstream_fair_sched_score(ngx_peer_connection_t *pc,
*/
return -fs->nreq * FS_TIME_SCALE_OFFSET;
} else {
- return (1 - fs->nreq) * (last_active_delta + FS_TIME_SCALE_OFFSET);
+ return (1 - fs->nreq) * FS_TIME_SCALE_OFFSET + last_active_delta;
}
}

0 comments on commit 33c3bc2

Please sign in to comment.