You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
upstream testing {
fair;
server foo.com:9000;
server bar.com:9000;
}
you would expect that upstream_fair would uniformly distribute requests to foo.com and bar.com. However, if foo.com resolves to multiple IP addresses then each address for foo.com will count as a different server.
I confirmed this behavior on Ubuntu by creating two entries for localhost within /etc/hosts
127.0.0.1 localhost
127.0.0.1 localhost
then when you configure upstream_fair with
upstream testing {
fair;
server localhost:9000;
server 127.0.0.1:9001;
}
then the backend on 9000 receives twice as many requests as 9001
The documentation for upstream_fair does not reflect this behavior. If this behavior is intentional then it seems worthwhile to update the documentation to reflect the behavior of the module. If you want to change the behavior of the module, see the ngx_http_upstream_init_fair_rr function. In particular see lines 464 and 465
for (i = 0; i < us->servers->nelts; i++) { // iterate over each host
for (j = 0; j < server[i].naddrs; j++) { // iterate over each address associated with each host
The text was updated successfully, but these errors were encountered:
I'm not sure this is a bug and it could be useful for poor man's dynamic backend configuration so I'd be more inclined to merge a patch documenting this behaviour rather than ripping it out.
If you have a configuration like this:
upstream testing {
fair;
server foo.com:9000;
server bar.com:9000;
}
you would expect that upstream_fair would uniformly distribute requests to foo.com and bar.com. However, if foo.com resolves to multiple IP addresses then each address for foo.com will count as a different server.
I confirmed this behavior on Ubuntu by creating two entries for localhost within /etc/hosts
127.0.0.1 localhost
127.0.0.1 localhost
then when you configure upstream_fair with
upstream testing {
fair;
server localhost:9000;
server 127.0.0.1:9001;
}
then the backend on 9000 receives twice as many requests as 9001
The documentation for upstream_fair does not reflect this behavior. If this behavior is intentional then it seems worthwhile to update the documentation to reflect the behavior of the module. If you want to change the behavior of the module, see the ngx_http_upstream_init_fair_rr function. In particular see lines 464 and 465
The text was updated successfully, but these errors were encountered: