Upstart: each process on different cores

I am trying to use an upstart to run multiple instances of node.js - each in a separate processor core that listens on a 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 can I indicate that each process should be run on a separate kernel to scale node.js inside the field?

0
source share
1 answer

taskset allows you to set a processor affinity for any Linux process. But the Linux kernel is already helping keep the process on a single processor to optimize performance.

0
source

Source: https://habr.com/ru/post/950630/


All Articles