From bc4603ded6a411713e3d8b40e230efd124309bcf Mon Sep 17 00:00:00 2001 From: Xiaochen Date: Thu, 21 Dec 2023 18:22:47 +0800 Subject: [PATCH] perf(proxy): use higher default keepalive request value for Nginx tuning (#12223) Bumped default values of `nginx_http_keepalive_requests` and `upstream_keepalive_max_requests` to `10000`. KAG-3360 --------- Co-authored-by: Datong Sun (cherry picked from commit f7e6eeefe006af11129d1b0e39a1c06449a53d42) --- changelog/unreleased/kong/optimize_keepalive_parameters.yml | 3 +++ kong.conf.default | 2 +- kong/templates/kong_defaults.lua | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/kong/optimize_keepalive_parameters.yml diff --git a/changelog/unreleased/kong/optimize_keepalive_parameters.yml b/changelog/unreleased/kong/optimize_keepalive_parameters.yml new file mode 100644 index 000000000000..49ec8baf6d4f --- /dev/null +++ b/changelog/unreleased/kong/optimize_keepalive_parameters.yml @@ -0,0 +1,3 @@ +message: Bumped default values of `nginx_http_keepalive_requests` and `upstream_keepalive_max_requests` to `10000`. +type: performance +scope: Configuration diff --git a/kong.conf.default b/kong.conf.default index fd5c43b4ea42..aa2d0810e49d 100644 --- a/kong.conf.default +++ b/kong.conf.default @@ -1183,7 +1183,7 @@ # It is recommended to set it to at least (number of regex paths * 2) # to avoid high CPU usages. -#nginx_http_keepalive_requests = 1000 # Sets the maximum number of client requests that can be served through one +#nginx_http_keepalive_requests = 10000 # Sets the maximum number of client requests that can be served through one # keep-alive connection. After the maximum number of requests are made, # the connection is closed. # Closing connections periodically is necessary to free per-connection diff --git a/kong/templates/kong_defaults.lua b/kong/templates/kong_defaults.lua index 12827b3a2989..5d7cf9e506c5 100644 --- a/kong/templates/kong_defaults.lua +++ b/kong/templates/kong_defaults.lua @@ -70,7 +70,7 @@ headers_upstream = x-kong-request-id trusted_ips = NONE error_default_type = text/plain upstream_keepalive_pool_size = 512 -upstream_keepalive_max_requests = 1000 +upstream_keepalive_max_requests = 10000 upstream_keepalive_idle_timeout = 60 allow_debug_header = off @@ -96,7 +96,7 @@ nginx_http_proxy_ssl_conf_command = NONE nginx_http_lua_ssl_conf_command = NONE nginx_http_lua_regex_match_limit = 100000 nginx_http_lua_regex_cache_max_entries = 8192 -nginx_http_keepalive_requests = 1000 +nginx_http_keepalive_requests = 10000 nginx_stream_ssl_conf_command = NONE nginx_stream_proxy_ssl_conf_command = NONE nginx_stream_lua_ssl_conf_command = NONE