-1

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.

Ozil
  • 945
  • 3
  • 11
  • 28
  • Possible duplicate - http://stackoverflow.com/questions/34682035/cluster-and-fork-mode-difference-in-pm2 – GPX Mar 08 '17 at 06:43
  • The above talks about `pm2` which is a advanced process manager. – Ozil Mar 08 '17 at 06:53
  • The answer and most of the arguments still apply because they're talking about the core concepts of clusters and fork. Can you see if they actually help? – GPX Mar 08 '17 at 06:54

1 Answers1

1

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.

Ozil
  • 945
  • 3
  • 11
  • 28