comparison src/http/modules/ngx_http_proxy_module.c @ 5832:d09b689911ac

Upstream: limited next_upstream time and tries (ticket #544). The new directives {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_tries and {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_timeout limit the number of upstreams tried and the maximum time spent for these tries when searching for a valid upstream.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 12 Sep 2014 18:50:47 +0400
parents c95d7882dfc9
children 2aff40b3dea2
comparison
equal deleted inserted replaced
5831:575175ebf4b4 5832:d09b689911ac
502 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 502 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
503 ngx_conf_set_bitmask_slot, 503 ngx_conf_set_bitmask_slot,
504 NGX_HTTP_LOC_CONF_OFFSET, 504 NGX_HTTP_LOC_CONF_OFFSET,
505 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream), 505 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream),
506 &ngx_http_proxy_next_upstream_masks }, 506 &ngx_http_proxy_next_upstream_masks },
507
508 { ngx_string("proxy_next_upstream_tries"),
509 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
510 ngx_conf_set_num_slot,
511 NGX_HTTP_LOC_CONF_OFFSET,
512 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_tries),
513 NULL },
514
515 { ngx_string("proxy_next_upstream_timeout"),
516 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
517 ngx_conf_set_msec_slot,
518 NGX_HTTP_LOC_CONF_OFFSET,
519 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_timeout),
520 NULL },
507 521
508 { ngx_string("proxy_pass_header"), 522 { ngx_string("proxy_pass_header"),
509 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 523 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
510 ngx_conf_set_str_array_slot, 524 ngx_conf_set_str_array_slot,
511 NGX_HTTP_LOC_CONF_OFFSET, 525 NGX_HTTP_LOC_CONF_OFFSET,
2453 * conf->ssl_crl = { 0, NULL }; 2467 * conf->ssl_crl = { 0, NULL };
2454 */ 2468 */
2455 2469
2456 conf->upstream.store = NGX_CONF_UNSET; 2470 conf->upstream.store = NGX_CONF_UNSET;
2457 conf->upstream.store_access = NGX_CONF_UNSET_UINT; 2471 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
2472 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
2458 conf->upstream.buffering = NGX_CONF_UNSET; 2473 conf->upstream.buffering = NGX_CONF_UNSET;
2459 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; 2474 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
2460 2475
2461 conf->upstream.local = NGX_CONF_UNSET_PTR; 2476 conf->upstream.local = NGX_CONF_UNSET_PTR;
2462 2477
2463 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; 2478 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
2464 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; 2479 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
2465 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; 2480 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
2481 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
2466 2482
2467 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; 2483 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
2468 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; 2484 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
2469 2485
2470 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; 2486 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
2541 } 2557 }
2542 2558
2543 ngx_conf_merge_uint_value(conf->upstream.store_access, 2559 ngx_conf_merge_uint_value(conf->upstream.store_access,
2544 prev->upstream.store_access, 0600); 2560 prev->upstream.store_access, 0600);
2545 2561
2562 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
2563 prev->upstream.next_upstream_tries, 0);
2564
2546 ngx_conf_merge_value(conf->upstream.buffering, 2565 ngx_conf_merge_value(conf->upstream.buffering,
2547 prev->upstream.buffering, 1); 2566 prev->upstream.buffering, 1);
2548 2567
2549 ngx_conf_merge_value(conf->upstream.ignore_client_abort, 2568 ngx_conf_merge_value(conf->upstream.ignore_client_abort,
2550 prev->upstream.ignore_client_abort, 0); 2569 prev->upstream.ignore_client_abort, 0);
2558 ngx_conf_merge_msec_value(conf->upstream.send_timeout, 2577 ngx_conf_merge_msec_value(conf->upstream.send_timeout,
2559 prev->upstream.send_timeout, 60000); 2578 prev->upstream.send_timeout, 60000);
2560 2579
2561 ngx_conf_merge_msec_value(conf->upstream.read_timeout, 2580 ngx_conf_merge_msec_value(conf->upstream.read_timeout,
2562 prev->upstream.read_timeout, 60000); 2581 prev->upstream.read_timeout, 60000);
2582
2583 ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
2584 prev->upstream.next_upstream_timeout, 0);
2563 2585
2564 ngx_conf_merge_size_value(conf->upstream.send_lowat, 2586 ngx_conf_merge_size_value(conf->upstream.send_lowat,
2565 prev->upstream.send_lowat, 0); 2587 prev->upstream.send_lowat, 0);
2566 2588
2567 ngx_conf_merge_size_value(conf->upstream.buffer_size, 2589 ngx_conf_merge_size_value(conf->upstream.buffer_size,