Search code examples
node.jsforkmultiprocessingmulticore

How to make sure that nodejs cluster assigns processes to different cores?


When utilizing multi cores via Node.js' cluster module is it guaranteed that each forked node worker is assigned to a different core?

If it's not guaranteed is there any way to control or manage it and eventually guarantee that all end up in different cores? Or the OS' scheduler distributes them evenly?


Solution

  • A while ago I did some tests with cluster module which you can check in this post that I wrote. Looking at the system monitor screenshots it is this pretty straightforward to understand what happens under the hood (with and without cluster module).