Node.js Cluster Module

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • const cluster = require("cluster")
  • cluster.fork()
  • cluster.isMaster
  • cluster.isWorker
  • cluster.schedulingPolicy
  • cluster.setupMaster(settings)
  • cluster.settings
  • cluster.worker // in worker
  • cluster.workers // in master

Remarks

Note that cluster.fork() spawns a child process that begins executing the current script from the beginning, in contrast to the fork() system call in C which clones the current process and continues from the instruction after the system call in both parent and child process.

The Node.js Documentation has a more complete guide to clusters here



Got any Node.js Question?