I am facing an issue when trying to keep more than 32768 concurrent HTTP connections in a nodejs server running on a SmartOS machine. Once I reach that number of concurrent connections, the server starts rejecting new HTTP requests.
I have already increased the max number of file descriptors to 999999 with ulimit:
[root ~]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
open files (-n) 999999
pipe size (512 bytes, -p) 10
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 99994
virtual memory (kbytes, -v) unlimited
This is my nodejs code:
var http = require("http");
var PORT = 4000;
var KEEPALIVE_SECS = 30;
http.createServer(function(request, response) {
response.writeHead(200, 'Ok');
setInterval(function() {
response.write('keepalive');
}, KEEPALIVE_SECS * 1000);
}).listen(PORT);
If I run two processes (listening on different ports) I can handle 32K x 2 = 64K concurrent connections, so I think the limitation has something to do with the max number of file descriptors per process. Is there any limitation in nodejs I should be aware of?
I am using node 0.10.4. The virtual machine I am using is hosted at Joyent, and is plenty of resources (16GB RAM and 12 VCPUs).
Thank you in advance,
Guido.
I am facing an issue when trying to keep more than 32768 concurrent HTTP connections in a nodejs server running on a SmartOS machine. Once I reach that number of concurrent connections, the server starts rejecting new HTTP requests.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
PD. There is no /proc/<pid>/limits in SmartOS.
--
Are you sure you're not running out of ephemeral ports?
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/cRRS7ZJkyzc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
I increased the number of ephimeral ports on the client before running it. In any case I don't think that is the issue, becasue when I run the same nodejs server process (on a different port), the two processes are able to handle 32K concurrent connections each (64K total).