The Cluster module works by having a master process fork multiple worker processes using child_process.fork() under the hood. Workers share the same server port via IPC, and the master distributes incoming connections using either a round-robin or OS-handled scheduling policy.
Internally, when cluster.fork() is called, the master process spawns a new child process using child_process.fork(), which creates a full copy of the Node.js process. The master process binds to the TCP port and passes connection handles to workers via IPC (Inter-Process Communication) sockets. Workers never directly bind to the port — they receive connection handles from the master.
Master process starts and calls cluster.fork() N times
Each fork creates a new OS-level process using child_process.fork()
Master process binds to the configured port
Incoming connections are received by the master
Master distributes connections to workers via IPC using a scheduling policy
Workers process the request and send responses directly to the client
SCHED_RR (Round-Robin): Default on Linux/macOS — master distributes connections evenly across workers
SCHED_NONE: Default on Windows — OS decides which worker gets the connection