Docker containers and Node.js clusters

后端 未结 3 624
慢半拍i
慢半拍i 2021-01-31 04:08

I have an api server running Node.js that was using it\'s cluster module and testing looked to be pretty good. Now our IT department wants to move to using Docker containers whi

3条回答
  •  無奈伤痛
    2021-01-31 04:58

    You'll have to measure to be sure, but my hunch would be running with node's cluster module would be worthwhile. It would get you more CPU utilization with the least amount of extra overhead. No extra containers to manage (start, stop, monitor). Plus the cluster workers have an efficient communication mechanism. The most reasonable evolution (don't skip steps) would seem to me:

    1. 1 container, 1 node process
    2. 1 container, several clustered node workers
    3. several containers, each with several node workers

提交回复
热议问题