I found a NodeJS script on Github rocketchat_loadtest_message_listener that allows to load test an NodeJS application called Rocket Chat. The script uses the NodeJS module cluster
; when the script is executed for the load testing, it forks individual processes for each user.
I have been testing with 10000 users, and in somewhere around I receive an error and my script exits. In htop
, I can see it creates around 8000 threads created before it exits.
node[43580]: pthread_create: Resource temporarily unavailable
internal/cluster/worker.js:54
return this.process.send.apply(this.process, arguments);
^
TypeError: Cannot read property 'apply' of undefined
at Worker.send (internal/cluster/worker.js:54:28)
at main (/home/ubuntu/rocketchat_loadtest_message_listener/message_listener/app.js:194:20)
at Object.<anonymous> (/home/ubuntu/rocketchat_loadtest_message_listener/message_listener/app.js:277:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
What seems to be the problem? Is it the linux kernel preventing or the NodeJS/NodeJS module to create the process/threads? I had tried altering the ulimit -s
but didn't see any difference. Here's the result of ulimit -a
.
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127506
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 127506
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited