From 44d38017606dace1de10917428119ad49ac67852 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 28 Feb 2016 17:11:12 +0900 Subject: [PATCH] nghttpx: Deprecate backend-http1-connections-per-frontend in favor of backend-connections-per-frontend --- gennghttpxfun.py | 3 ++- src/shrpx.cc | 20 ++++++++++++++------ src/shrpx_config.cc | 14 ++++++++++++++ src/shrpx_config.h | 2 ++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/gennghttpxfun.py b/gennghttpxfun.py index 8ff8cf83..6609a910 100755 --- a/gennghttpxfun.py +++ b/gennghttpxfun.py @@ -124,7 +124,8 @@ OPTIONS = [ "tls-ticket-key-memcached-address-family", "backend-address-family", "frontend-http2-max-concurrent-streams", - "backend-http2-max-concurrent-streams" + "backend-http2-max-concurrent-streams", + "backend-connections-per-frontend" ] LOGVARS = [ diff --git a/src/shrpx.cc b/src/shrpx.cc index c52a3c99..76e6f3f0 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1362,12 +1362,13 @@ Performance: --backend-http1-connections-per-frontend. Default: )" << get_config()->conn.downstream.connections_per_host << R"( - --backend-http1-connections-per-frontend= - Set maximum number of backend concurrent HTTP/1 - connections per frontend. This option is only used for - default mode. 0 means unlimited. To limit the number - of connections per host for HTTP/2 or SPDY proxy mode - (-s option), use --backend-http1-connections-per-host. + --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 for HTTP/2 or + SPDY proxy mode (-s option), use + --backend-http1-connections-per-host. Default: )" << get_config()->conn.downstream.connections_per_frontend << R"( --rlimit-nofile= @@ -2473,6 +2474,8 @@ int main(int argc, char **argv) { &flag, 117}, {SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS, required_argument, &flag, 118}, + {SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND, required_argument, &flag, + 119}, {nullptr, 0, nullptr, 0}}; int option_index = 0; @@ -2978,6 +2981,11 @@ int main(int argc, char **argv) { cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS, optarg); break; + case 119: + // --backend-connections-per-frontend + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND, + optarg); + break; default: break; } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 85c36e68..2c8a0958 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -654,6 +654,7 @@ enum { SHRPX_OPTID_ALTSVC, SHRPX_OPTID_BACKEND, SHRPX_OPTID_BACKEND_ADDRESS_FAMILY, + SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND, SHRPX_OPTID_BACKEND_HTTP_PROXY_URI, SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND, SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST, @@ -1344,6 +1345,15 @@ int option_lookup_token(const char *name, size_t namelen) { break; } break; + case 32: + switch (name[31]) { + case 'd': + if (util::strieq_l("backend-connections-per-fronten", name, 31)) { + return SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND; + } + break; + } + break; case 33: switch (name[32]) { case 'l': @@ -2045,6 +2055,10 @@ int parse_config(const char *opt, const char *optarg, return 0; } case SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND: + LOG(WARN) << opt << ": deprecated. Use " + << SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND << " instead."; + // fall through + case SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND: return parse_uint(&mod_config()->conn.downstream.connections_per_frontend, opt, optarg); case SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT: diff --git a/src/shrpx_config.h b/src/shrpx_config.h index b54951dd..611e40ab 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -232,6 +232,8 @@ constexpr char SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS[] = "frontend-http2-max-concurrent-streams"; constexpr char SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS[] = "backend-http2-max-concurrent-streams"; +constexpr char SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND[] = + "backend-connections-per-frontend"; constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;