By Mark Adel
I have a NodeJS API running on a 4GB Memory and 2 Core CPU Standard Droplets. The API has real time functionalities using Socket.io and is serving around 500 concurrent users.
Lately I noticed that the API sometimes stop handling any requests for like 5 - 10 seconds and then continues to work.
When I checked Nginx error logs I found this alert occurring a lot :-
[alert] 7193#7193: 768 worker_connections are not enough
Could this be the issue making the API miss some requests?
And how do I know what is the maximum worker_connections I can set? Currently it is set to 768
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
worker_connections is bound by worker_rlimit_nofile. So always set it to be equal or less than the value of worker_rlimit_nofile. worker_rlimit_nofile is bound by the ulimit of number of open files for the user (/etc/security/limits.conf) and is in turn limited by the kernel’s fs.file-max:
# sysctl fs.file-max
fs.file-max = 9883453
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.