mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-03 12:03:02 +00:00
BUG/MINOR: hash-balance-factor isn't effective in certain circumstances
in chash_get_server_hash, we find the nearest server entries both before and after the request hash. If the next and prev entries both point to the same server, the function would exit early and return that server, to save work. Before hash-balance-factor this was a valid optimization -- one of nsrv and psrv would definitely be chosen, so if they are the same there's no need to choose between them. But with hash-balance-factor it's possible that adding another request to that server would overload it (chash_server_is_eligible returns false) and we go further around the ring. So it's not valid to return before checking for that. This commit simply removes the early return, as it provides a minimal savings even when it's correct.
This commit is contained in:
parent
e068b60605
commit
18330ab17f
@ -306,10 +306,8 @@ struct server *chash_get_server_hash(struct proxy *p, unsigned int hash)
|
||||
|
||||
nsrv = eb32_entry(next, struct tree_occ, node)->server;
|
||||
psrv = eb32_entry(prev, struct tree_occ, node)->server;
|
||||
if (nsrv == psrv)
|
||||
return nsrv;
|
||||
|
||||
/* OK we're located between two distinct servers, let's
|
||||
/* OK we're located between two servers, let's
|
||||
* compare distances between hash and the two servers
|
||||
* and select the closest server.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user