Should You Use PM2, Node Cluster, or Neither in Kubernetes?

蹲街弑〆低调 提交于 2020-06-09 12:31:51

问题


I am deploying some NodeJS code into Kubernetes. It used to be that you needed to run either PM2 or the NodeJS cluster module in order to take full advantage of multi-core hardware.

Now that we have Kubernetes, it is unclear if one must use one or the other, to get the full benefit of multiple cores.

Should a person specify the number of CPU units in their pod YAML configuration?

Or is there simply no need to account for multiple cores with NodeJS in Kubernetes?


回答1:


You'll achieve utilization of multiple cores either way; the difference being that with the nodejs cluster module approach, you'd have to "request" more resources from Kubernetes (i.e., multiple cores), which might be more difficult for Kubernetes to schedule than a few different containers requesting one core (or less...) each (which it can, in turn, schedule on multiple nodes, and not necessarily look for one node with enough available cores).



来源:https://stackoverflow.com/questions/52501858/should-you-use-pm2-node-cluster-or-neither-in-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!