Is forking more efficient* as compared to clustering in NodeJS HTTP Server?
More specifically I'm talking about using http
module of NodeJS and child_process.fork
and cluster
module.
*The term efficient constitutes of memory usage and average throughput.
From NodeJS official docs
The worker processes are spawned using the child_process.fork() method, so that they can communicate with the parent via IPC and pass server handles back and forth.
The cluster module supports methods for distributing incoming connections, while forking requires you to handle the connections on your own.