<p>I was wondering if it makes sense to add the cluster package to a node application deployed using kubernetes requiring one or less cores.</p>

<p>When using the cluster package we usually do something like <a href="https://dev.to/acanimal/understanding-the-nodejs-cluster-module-14-2bi" rel="nofollow noreferrer">this</a>:</p>

<pre><code>const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;

if (cluster.isMaster) {
  masterProcess();
} else {
  childProcess();  
}

function masterProcess() {
  console.log(`Master ${process.pid} is running`);

  for (let i = 0; i &lt; numCPUs; i++) {
    console.log(`Forking process number ${i}...`);
    cluster.fork();
  }

  process.exit();
}

function childProcess() {
  console.log(`Worker ${process.pid} started and finished`);

  process.exit();
}
</code></pre>

<p>But it wouldn't make sense to me to use that with say</p>

<pre><code>resources:
      limits:
        cpu: "1"
      requests:
        cpu: "0.5"
</code></pre>

<p>since kubernetes will limit the application cpu time any ways, even when using multiple workers. Does that make sense?</p>

<p>I haven't tried this with a load yet.</p>

<p>Well, since you’re using containers, there is really no need to use the cluster module. Just spin a new container and distribute load using a load balancer like Nginx. I hope this helps. </p>
