Node.js on multi-core machines

前端 未结 15 1327
猫巷女王i
猫巷女王i 2020-11-22 07:46

Node.js looks interesting, BUT I must miss something - isn\'t Node.js tuned only to run on a single process and thread?

Then how does it scale for m

15条回答
  •  灰色年华
    2020-11-22 08:10

    The cluster module allows you to utilise all cores of your machine. In fact you can take advantage of this in just 2 commands and without touching your code using a very popular process manager pm2.

    npm i -g pm2
    pm2 start app.js -i max
    

提交回复
热议问题