I'm trying to use upstart to launch multiple instances of node.js - each on separate cpu core listening on different port.
Launch configuration:
start on startup
task
env NUM_WORKERS=2
script
for i in `seq 1 $NUM_WORKERS`
do
start worker N=$i
done
end script
Worker configuration:
instance $N
script
export HOME="/node"
echo $$ > /var/run/worker-$N.pid
exec sudo -u root /usr/local/bin/node /node/server.js >> /var/log/worker-$N.sys.log 2>&1
end script
How do I specify that each process should be launched on a separate core to scale node.js inside the box?
cluster
module is still Stability 1 - Experimental. Keep that in mind for future if you are using it. – Surfboardcluster
but I would like to usenginx
for internal load balancing between ports and then useupstart
andmonit
to make sure all workers are running. So, is there a way to spread workers across cpu cores, one per core? I failed to find any info on this in upstart's cookbook. Any help would be appreciated. – Bendwise