comparison src/http/modules/ngx_http_upstream_hash_module.c @ 6705:29bf0dbc0a77

Upstream: max_conns.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 22 Sep 2016 19:32:47 +0300
parents 914d8a63dbad
children 6c52b24fcf8e
comparison
equal deleted inserted replaced
6704:a44ba757851d 6705:29bf0dbc0a77
240 && now - peer->checked <= peer->fail_timeout) 240 && now - peer->checked <= peer->fail_timeout)
241 { 241 {
242 goto next; 242 goto next;
243 } 243 }
244 244
245 if (peer->max_conns && peer->conns >= peer->max_conns) {
246 goto next;
247 }
248
245 break; 249 break;
246 250
247 next: 251 next:
248 252
249 if (++hp->tries > 20) { 253 if (++hp->tries > 20) {
546 && now - peer->checked <= peer->fail_timeout) 550 && now - peer->checked <= peer->fail_timeout)
547 { 551 {
548 continue; 552 continue;
549 } 553 }
550 554
555 if (peer->max_conns && peer->conns >= peer->max_conns) {
556 continue;
557 }
558
551 peer->current_weight += peer->effective_weight; 559 peer->current_weight += peer->effective_weight;
552 total += peer->effective_weight; 560 total += peer->effective_weight;
553 561
554 if (peer->effective_weight < peer->weight) { 562 if (peer->effective_weight < peer->weight) {
555 peer->effective_weight++; 563 peer->effective_weight++;
645 "load balancing method redefined"); 653 "load balancing method redefined");
646 } 654 }
647 655
648 uscf->flags = NGX_HTTP_UPSTREAM_CREATE 656 uscf->flags = NGX_HTTP_UPSTREAM_CREATE
649 |NGX_HTTP_UPSTREAM_WEIGHT 657 |NGX_HTTP_UPSTREAM_WEIGHT
658 |NGX_HTTP_UPSTREAM_MAX_CONNS
650 |NGX_HTTP_UPSTREAM_MAX_FAILS 659 |NGX_HTTP_UPSTREAM_MAX_FAILS
651 |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 660 |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
652 |NGX_HTTP_UPSTREAM_DOWN; 661 |NGX_HTTP_UPSTREAM_DOWN;
653 662
654 if (cf->args->nelts == 2) { 663 if (cf->args->nelts == 2) {