What are the effective differences between child_process.fork and cluster.fork?

后端 未结 2 1815
自闭症患者
自闭症患者 2021-01-02 01:28

I understand that cluster.fork will allow for multiple processes to listen on the same port(s), what I also want to know is how much additional overhead is there in supporti

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-02 02:19

    cluser.fork is implemented on top of child_process.fork. The extra stuff that cluster.fork brings is that, it will enable you to listen on a shared port. If you don't want it, just use child_process.fork. So yeah, use cluster for web servers and child_process for workers.

提交回复
热议问题