Reputation: 1
How can I troubleshoot the '38341 socket() failed (24: Too many open files) while connecting to upstream' error in Nginx, despite having increased both the 'somaxconn' parameter and the 'ulimit' on my server? I've followed solutions found through Google, including adjusting system-wide limits and configurations in 'nginx.conf' and 'website.conf', but the issue persists. Attached are screenshots of these configurations for referenceenter image description here
step1) fs.file-max = 2097152
sysctl -w net.core.somaxconn=500000
vm.max_map_count = 250000 net.ipv4.ip_local_port_range = 1024 500000
i have increased above parameter on /etc/sysctl.conf
step2) i have increased umlimit on /etc/security/limit.conf
root hard nofile 500000 root soft nofile 500000
But still my issue not resolved issue according to nginx log Too many files are openning and due to this my websites api response time is too slow & when i restart nginx it works sometime but please any one guide me where i am wrong and help to resolves this issue
below is the my server cpu information
lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 24 On-line CPU(s) list: 0-23 Thread(s) per core: 2 Core(s) per socket: 12 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel BIOS Vendor ID: Intel CPU family: 6 Model: 106 Model name: Intel(R) Xeon(R) Silver 4310 CPU @ 2.10GHz BIOS Model name: Intel(R) Xeon(R) Silver 4310 CPU @ 2.10GHz Stepping: 6 CPU MHz: 3300.000 CPU max MHz: 3300.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.00 Virtualization: VT-x L1d cache: 48K L1i cache: 32K L2 cache: 1280K L3 cache: 18432K NUMA node0 CPU(s): 0-23
Upvotes: 0
Views: 165
Reputation: 2188
Run the lsof command to list open files.
Something is opening an abnormal amount of files on your server so instead of trying to change limits you should find out what is opening too many files and address that.
Further reading: https://alvinalexander.com/blog/post/linux-unix/linux-lsof-command/
Upvotes: 0