Can we configure nginx_worker_connections?

Tried with KONG_NGINX_EVENTS_WORKER_CONNECTIONS, but couldn’t set.

worker_processes auto;         
daemon off;                    
pid pids/;            
error_log /dev/stderr debug;   
worker_rlimit_nofile 1048576;  
events {                       
    worker_connections 16384;  
    multi_accept on;           
http {                         
    include 'nginx-kong.conf'; 

I think we need custom nginx template

The worker_connections will be automatically set to the ulimit you set for the Kong process.
If you wish to set it to a value higher than the default 16384, you need to bump up the ulimit and Kong will automatically render the Nginx template with the increased worker_connections count.

What is ulimit type use to change defaut worker_connections?

I try in docker

docker run --ulimit nofile=12345:12345 ... kong

It’s only change worker_rlimit_nofile not worker_connections

Open files allowed:
ulimit -n

I’m not familiar with how to set it for a docker based process but I’m sure that should be possible.

ulimit -n works fine, but in docker with --ulimit nofile=12345:12345 just work for worker_rlimit_nofile only :thinking:

I’m not sure about Docker but the following works for me:

root@ubuntu-bionic:~# ulimit -n 12345
root@ubuntu-bionic:~# kong prepare
root@ubuntu-bionic:~# cat /usr/local/kong/nginx.conf | grep worker_
worker_processes auto;
worker_rlimit_nofile 12345;
    worker_connections 12345;

For kong version: 1.4.0 using the official docker image

env | grep KONG_NGINX_


kong prepare && grep “worker_” /usr/local/kong/nginx.conf

worker_processes 1;
worker_rlimit_nofile 65536;
worker_connections 16384;

seem to be an issue with the variable WORKER_CONNECTIONS
events {

if nginx_optimizations then
worker_connections ${{WORKER_CONNECTIONS}};
multi_accept on;

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ