I run a NodeJS application on Debian system, but last time I got in trouble with it.
I use http.createServer to run it and it seems that it supports only 6 opened connections at one time. That means if I poll the requests for 10 seconds, new have to wait these 10 seconds until previous are closed so they can get in.
I've completly ran out of ideas why it happens and I have no idea if its cause of the OS settings or applications, so I would really appreciate any advices.
Thanks!
If you want to increase the number of connections that your application should handle at a time then use the POSIX
module to raise the limit on the number of file descriptors your process can use.
Install posix
npm install posix
Then in your code which runs the server
var posix = require('posix');
// raise maximum number of open file descriptors to 1k,
posix.setrlimit('nofile', { soft: 1000 });
// Note: The hard limit is unchanged after this, it updates the soft limit only.