nodejs - optimum number of workers in cluster

Viewed 1102

When clustering nodejs on a multi-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 (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 (for the main nodejs server)?

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

1 Answers
Related