ufk ufk - 1 year ago 107
Node.js Question

several nodejs apps share same cpu0 or are they divided between cpus?

I have an a big NodeJS 7.2.0 application that require a lot of cpu power.
I started diving it to separate applications in order for each process to use a different CPU.

i have a server on amazon with 8 Virtual CPUs.

I've been told lately that each nodejs process uses CPU0 by default and there is no way to change that, which means that diving my big application so as many microservices as I want wouldn't really resolve my issue.

is that really the case? will all nodejs processes use CPU0 by default? is there a way to change that ?

any information regarding the issue would be greatly appreciated.


Answer Source

I don't think you can choose which cpu to run your process in the node.js side. However you can set the cpu priority in the OS level.

Ref: taskset equivalent in windows

Another solution is using the node cluster. https://nodejs.org/api/cluster.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download