worker_connections are not enough, reusing connections with idle workers

Roger Fischer roger at netskrt.io
Tue Jun 7 21:42:23 UTC 2022


Here are the additional details:

$ uname -a
Linux a002 4.15.0-177-generic #186-Ubuntu SMP Thu Apr 14 20:23:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

$ ulimit -Hn
1048576

$ ulimit -Sn
1024

$ cat /proc/sys/fs/file-max
262144

worker_rlimit_nofile 65535;

The ulimits are for the user that nginx runs at (only the master process runs as root).

Roger



> On Jun 7, 2022, at 2:29 PM, Sergey A. Osokin <osa at freebsd.org.ru> wrote:
> 
> On Tue, Jun 07, 2022 at 01:18:36PM -0700, Roger Fischer wrote:
>> 
>> We are simulating 1000 clients. Some get cache hits, and some go upstream. So there are more than 1000 connections.
>> 
>> We have 24 workers running, each configured: events { worker_connections  1024; }
>> 
>> We are seeing the following errors from nginx:
>> [warn] 21151#21151: 1024 worker_connections are not enough, reusing connections
>> [crit] 21151#21151: accept4() failed (24: Too many open files)
>> [alert] 21151#21151: *15716 socket() failed (24: Too many open files) while connecting to upstream,
>> 
>> I am assuming the second and third error are for the OS limit. But the first seems to be from a worker process.
> 
> That looks like OS or user account limits, so could you share an
> output of the followoing commands:
> 
> % uname -a
> % cat /etc/*release
> % ulimit -Hn
> % ulimit -Sn
> % cat /proc/sys/fs/file-max
> 
> Also, it's possible to increase nginx limits with the worker_rlimit_nofile
> directive, http://nginx.org/ru/docs/ngx_core_module.html#worker_rlimit_nofile
> 
> Thank you.
> 
> --
> Sergey A. Osokin
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220607/4aa6d572/attachment.htm>


More information about the nginx mailing list