From 2326337d323cac84d658d543ab1f99cdd4d71877 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 28 Feb 2016 22:15:49 +0900 Subject: [PATCH] nghttpx: Deprecate backend-http1-connections-per-host in favor of backend-connections-per-host --- gennghttpxfun.py | 3 ++- src/shrpx.cc | 32 +++++++++++++++++++------------- src/shrpx_config.cc | 12 +++++++++++- src/shrpx_config.h | 2 ++ 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/gennghttpxfun.py b/gennghttpxfun.py index 5ffb960d..9df537f1 100755 --- a/gennghttpxfun.py +++ b/gennghttpxfun.py @@ -126,7 +126,8 @@ OPTIONS = [ "frontend-http2-max-concurrent-streams", "backend-http2-max-concurrent-streams", "backend-connections-per-frontend", - "backend-tls" + "backend-tls", + "backend-connections-per-host" ] LOGVARS = [ diff --git a/src/shrpx.cc b/src/shrpx.cc index 7a9616f7..333dbc13 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1356,23 +1356,24 @@ Performance: accepts. Setting 0 means unlimited. Default: )" << get_config()->conn.upstream.worker_connections << R"( - --backend-http1-connections-per-host= - Set maximum number of backend concurrent HTTP/1 - connections per origin host. This option is meaningful - when --http2-proxy option is used. The origin host is - determined by authority portion of request URI (or - :authority header field for HTTP/2). To limit the - number of connections per frontend for default mode, use + --backend-connections-per-host= + Set maximum number of backend concurrent connections + (and/or streams in case of HTTP/2) per origin host. + This option is meaningful when --http2-proxy option is + used. The origin host is determined by authority + portion of request URI (or :authority header field for + HTTP/2). To limit the number of connections per + frontend for default mode, use --backend-connections-per-frontend. Default: )" << get_config()->conn.downstream.connections_per_host << R"( --backend-connections-per-frontend= - Set maximum number of backend concurrent connections (or - streams in case of HTTP/2) per frontend. This option is - only used for default mode. 0 means unlimited. To - limit the number of connections per host with - --http2-proxy option, use - --backend-http1-connections-per-host. + Set maximum number of backend concurrent connections + (and/or streams in case of HTTP/2) per frontend. This + option is only used for default mode. 0 means + unlimited. To limit the number of connections per host + with --http2-proxy option, use + --backend-connections-per-host. Default: )" << get_config()->conn.downstream.connections_per_frontend << R"( --rlimit-nofile= @@ -2440,6 +2441,7 @@ int main(int argc, char **argv) { {SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND, required_argument, &flag, 119}, {SHRPX_OPT_BACKEND_TLS, no_argument, &flag, 120}, + {SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST, required_argument, &flag, 121}, {nullptr, 0, nullptr, 0}}; int option_index = 0; @@ -2954,6 +2956,10 @@ int main(int argc, char **argv) { // --backend-tls cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_TLS, "yes"); break; + case 121: + // --backend-connections-per-host + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST, optarg); + break; default: break; } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 8a1d2103..5f2e51cb 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -694,6 +694,7 @@ enum { SHRPX_OPTID_BACKEND, SHRPX_OPTID_BACKEND_ADDRESS_FAMILY, SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND, + SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST, SHRPX_OPTID_BACKEND_HTTP_PROXY_URI, SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND, SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST, @@ -1370,6 +1371,11 @@ int option_lookup_token(const char *name, size_t namelen) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS; } break; + case 't': + if (util::strieq_l("backend-connections-per-hos", name, 27)) { + return SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST; + } + break; } break; case 30: @@ -2082,7 +2088,11 @@ int parse_config(const char *opt, const char *optarg, "--host-rewrite option."; return 0; - case SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST: { + case SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST: + LOG(WARN) << opt + << ": deprecated. Use backend-connections-per-host instead."; + // fall through + case SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST: { int n; if (parse_uint(&n, opt, optarg) != 0) { diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 874dabe1..72594fa8 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -235,6 +235,8 @@ constexpr char SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS[] = constexpr char SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND[] = "backend-connections-per-frontend"; constexpr char SHRPX_OPT_BACKEND_TLS[] = "backend-tls"; +constexpr char SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST[] = + "backend-connections-per-host"; constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;