Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(conf) lower bound to worker_connections and worker_rlimit_nofile #9276

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@
- Add LMDB dbless config persistence and removed the JSON based
config cache for faster startup time
[#8670](https://github.com/Kong/kong/pull/8670)
- `nginx_events_worker_connections=auto` has a lower bound of 1024
[#9276](https://github.com/Kong/kong/pull/9276)
- `nginx_main_worker_rlimit_nofile=auto` has a lower bound of 1024
[#9276](https://github.com/Kong/kong/pull/9276)

#### PDK
- Added new PDK function: `kong.request.get_start_time()`
Expand Down
6 changes: 4 additions & 2 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,8 @@
#
# The special and default value of `auto` sets this
# value to `ulimit -n` with the upper bound limited to
# 16384 as a measure to protect against excess memory use.
# 16384 as a measure to protect against excess memory use,
# and the lower bound of 1024 as a good default.
#
# See http://nginx.org/en/docs/ngx_core_module.html#worker_rlimit_nofile

Expand All @@ -942,7 +943,8 @@
#
# The special and default value of `auto` sets this
# value to `ulimit -n` with the upper bound limited to
# 16384 as a measure to protect against excess memory use.
# 16384 as a measure to protect against excess memory use,
# and the lower bound of 1024 as a good default.
#
# See http://nginx.org/en/docs/ngx_core_module.html#worker_connections

Expand Down
1 change: 1 addition & 0 deletions kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ local function compile_conf(kong_config, conf_template)
end

value = math.min(value, 16384)
value = math.max(value, 1024)
ADD-SP marked this conversation as resolved.
Show resolved Hide resolved

if worker_rlimit_nofile_auto then
worker_rlimit_nofile_auto.value = value
Expand Down
1 change: 1 addition & 0 deletions spec/01-unit/04-prefix_handler_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ describe("NGINX conf compiler", function()

local ulimit = prefix_handler.get_ulimit()
ulimit = math.min(ulimit, 16384)
ulimit = math.max(ulimit, 1024)

local nginx_conf = prefix_handler.compile_nginx_conf(conf)
assert.matches("worker_rlimit_nofile%s+" .. ulimit .. ";", nginx_conf)
Expand Down