Saturday, 27 May 2017

nodejs - optimum number of workers in cluster

When clustering nodejs on multiple core processor I usually see examples saying -

const numCPUs = require('os').cpus().length;
for (let i = 0; i < numCPUs; i++) {
    cluster.fork();
  }

My questions are -

  1. If a multi core processor is running a web app with a reverse proxy terminating ssl (cpu intensive), gzipping and ungzipping (cpu intensive) and doing other stuff + there are other servers doing cpu intensive work of main nodejs server, is it still wise to spawn as many workers as the number of cpu cores?

  2. What tests should be run to come to the optimal number of workers?



via vjjj

No comments:

Post a Comment