This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new fda20d9 feature: make the number of file is as configurable as the connections. (#1098) fda20d9 is described below commit fda20d99d55d91905622b9d780e4dce79d128e76 Author: 罗泽轩 <spacewander...@gmail.com> AuthorDate: Sun Feb 2 09:13:34 2020 +0800 feature: make the number of file is as configurable as the connections. (#1098) --- bin/apisix | 9 ++++++++- conf/config.yaml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/apisix b/bin/apisix index 89b2632..0102c38 100755 --- a/bin/apisix +++ b/bin/apisix @@ -88,7 +88,7 @@ worker_cpu_affinity auto; error_log {* error_log *} {* error_log_level or "error" *}; pid logs/nginx.pid; -worker_rlimit_nofile 20480; +worker_rlimit_nofile {* worker_rlimit_nofile *}; events { accept_mutex off; @@ -524,6 +524,13 @@ local function init() sys_conf[k] = v end + local wrn = sys_conf["worker_rlimit_nofile"] + local wc = sys_conf["event"]["worker_connections"] + if not wrn or wrn <= wc then + -- ensure the number of fds is slightly larger than the number of conn + sys_conf["worker_rlimit_nofile"] = wc + 128 + end + if(sys_conf["enable_dev_mode"] == true) then sys_conf["worker_processes"] = 1 else diff --git a/conf/config.yaml b/conf/config.yaml index 18d1ec3..274a8cf 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -59,6 +59,7 @@ apisix: nginx_config: # config for render the template to genarate nginx.conf error_log: "logs/error.log" error_log_level: "warn" # warn,error + worker_rlimit_nofile: 20480 # the number of files a worker process can open, should be larger than worker_connections event: worker_connections: 10620 http: