No matter what size instance we use Node always appears to max out at 1000 concurrent connections (this is NOT 1000 per second, but 1000 it can handle

Node.js maxing out at 1000 concurrent connections

submited by
Style Pass
2022-06-22 08:30:08

No matter what size instance we use Node always appears to max out at 1000 concurrent connections (this is NOT 1000 per second, but 1000 it can handle at 1 time). Shortly after that the CPU spikes and node basically freezes.

You've reached the default limit of file descriptors a process can use (1024). You can check the limit on the command line by running "ulimit -n". To change the limit, you need to edit /etc/security/limits.conf. Add the follow block:

"*" applies to all users except root. Limits for root must be added separately. There are soft and hard limit. Users are allowed to change their own limits up to the soft limit but not exceeding the hard limit.

Once the file has been edited, log out and back in again. Verify the change by running ulimit -n. Restart your Node process and you should be good to go.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Leave a Comment