您应该在Kubernetes中使用PM2,节点集群还是两者都不使用? [英] Should You Use PM2, Node Cluster, or Neither in Kubernetes?

查看:246
本文介绍了您应该在Kubernetes中使用PM2,节点集群还是两者都不使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一些NodeJS代码部署到Kubernetes中.过去,您需要运行PM2或NodeJS集群模块才能充分利用多核硬件.

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.

现在我们有了Kubernetes,尚不清楚是否必须使用一个或另一个才能充分利用多核的好处.

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

是否应该指定他们的pod YAML配置中的CPU单元?

还是在Kubernetes中根本不需要使用NodeJS来考虑多个内核?

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

推荐答案

您将通过两种方式实现对多个内核的利用.区别在于,使用nodejs集群模块方法时,您必须从Kubernetes(即多个内核)请求"更多资源,这对于Kubernetes而言可能比一些请求一个内核(或更少内核)的不同容器更加困难...)每个节点(依次可以在多个节点上调度,而不必寻找一个具有足够可用核心的节点).

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).

这篇关于您应该在Kubernetes中使用PM2,节点集群还是两者都不使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆