Mercurial > hg > nginx
comparison src/http/modules/ngx_http_upstream_hash_module.c @ 7124:3b4fa572d56d
Upstream hash: reordered peer checks.
This slightly reduces cost of selecting a peer if all or almost all peers
failed, see ticket #1030. There should be no measureable difference with
other workloads.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 05 Oct 2017 17:43:05 +0300 |
parents | 6c52b24fcf8e |
children | ed599ea6c1f1 |
comparison
equal
deleted
inserted
replaced
7123:6c52b24fcf8e | 7124:3b4fa572d56d |
---|---|
541 | 541 |
542 if (peer->down) { | 542 if (peer->down) { |
543 continue; | 543 continue; |
544 } | 544 } |
545 | 545 |
546 if (peer->server.len != server->len | |
547 || ngx_strncmp(peer->server.data, server->data, server->len) | |
548 != 0) | |
549 { | |
550 continue; | |
551 } | |
552 | |
553 if (peer->max_fails | 546 if (peer->max_fails |
554 && peer->fails >= peer->max_fails | 547 && peer->fails >= peer->max_fails |
555 && now - peer->checked <= peer->fail_timeout) | 548 && now - peer->checked <= peer->fail_timeout) |
556 { | 549 { |
557 continue; | 550 continue; |
558 } | 551 } |
559 | 552 |
560 if (peer->max_conns && peer->conns >= peer->max_conns) { | 553 if (peer->max_conns && peer->conns >= peer->max_conns) { |
554 continue; | |
555 } | |
556 | |
557 if (peer->server.len != server->len | |
558 || ngx_strncmp(peer->server.data, server->data, server->len) | |
559 != 0) | |
560 { | |
561 continue; | 561 continue; |
562 } | 562 } |
563 | 563 |
564 peer->current_weight += peer->effective_weight; | 564 peer->current_weight += peer->effective_weight; |
565 total += peer->effective_weight; | 565 total += peer->effective_weight; |