Skip to content

Commit

Permalink
Use only half of the server's cores
Browse files Browse the repository at this point in the history
  • Loading branch information
balhar-jakub committed Mar 6, 2019
1 parent 1857ab9 commit 38afeec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ var ClusterStore = require('strong-cluster-connect-store')(session);
if(cluster.isMaster) {
ClusterStore.setup();
var cpuCount = require('os').cpus().length;
console.log('CpuFull', cpuCount);
cpuCount = Math.ceil(cpuCount / 2);
console.log('Cpu Count: ', cpuCount);

// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) {
Expand Down

0 comments on commit 38afeec

Please sign in to comment.