[upstream] consistent hash support backup?

洪志道 hongzhidao at gmail.com
Mon Nov 6 13:35:14 UTC 2017


Hi!

We know that consistent hash upstream improve its selection in the latest
version.

-        if (hp->tries >= points->number) {
<http://hg.nginx.org/nginx/rev/6c52b24fcf8e#l1.19>-
pc->name = hp->rrp.peers->name;
<http://hg.nginx.org/nginx/rev/6c52b24fcf8e#l1.20>+        if
(hp->tries > 20) { <http://hg.nginx.org/nginx/rev/6c52b24fcf8e#l1.21>
           ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);
<http://hg.nginx.org/nginx/rev/6c52b24fcf8e#l1.22>-            return
NGX_BUSY; <http://hg.nginx.org/nginx/rev/6c52b24fcf8e#l1.23>+
  return hp->get_rr_peer(pc, &hp->rrp);



Does it mean that "backup" option is allowed in the module?


                   |NGX_HTTP_UPSTREAM_MAX_CONNS
                   |NGX_HTTP_UPSTREAM_MAX_FAILS
                   |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
+                  |NGX_HTTP_UPSTREAM_BACKUP
                   |NGX_HTTP_UPSTREAM_DOWN;


I wonder how to archive the effect of "backup" in hash like round robin,

even if we don't want to use error_page.


Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20171106/1c1a616e/attachment.html>


More information about the nginx-devel mailing list