Node.js的的CPU利用率在Amazon EC2 [英] CPU utilization of Node.js on Amazon EC2

查看:146
本文介绍了Node.js的的CPU利用率在Amazon EC2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看到如何节点是单线程的,如果我有在Amazon EC2实例上运行4个EC2计算单元节点服务器将它的运行速度比,如果我有2个EC2计算单元的任何更快/处理更大的负载?

Seeing as how node is single threaded, If I have node server running on an amazon EC2 instance with 4 EC2 Compute units will it run any faster / handle more load than if I have 2 EC2 Compute units?

请问CPU使用率在亚马逊需要一个程序是多线程的,以充分利用所有的资源?

Does CPU utilization on amazon require a program to be multithreaded to fully use all resources?

推荐答案

简短的回答是不。更多的内核将不会增加您的节点性能,在默认情况下(你会被一个CPU绑定)。

The short answer is "no". More cores will not increase your node performance, by default (you will be bound by a single CPU).

的node.js使用事件循环进行处理,因此,如果你正在做的是启动一个单一的node.js过程中无任何东西,也不会是多线程,因此不能使用一个以上的CPU。

node.js uses an event loop for processing, so if all you are doing is starting up a single node.js process without anything else, it will not be multi-threaded and thus not use more than one CPU.

不过,你可以使用一些Node.js的包来解决这个限制(产卵多个进程 - 透明)。其中最流行的是集群。还有其他的替代品,例如神游(节点是新的,仍在发展)。你也可以使用代理

However, you can use some node.js packages to get around this limitation (spawn multiple processes - transparently). One of the most popular is cluster. There are other alternatives, for example fugue (node is new and still evolving). You could also use a proxy.

请参阅此职位的一些<一href="http://stackoverflow.com/questions/7259232/how-to-deploy-node-js-in-cloud-for-high-availability-using-multi-core-reverse-pr">more详细的产品配置。

另外一个细节:EC2计算单位是每实例详细。对于某些情况下,你可以为每个虚拟内核获得更多的计算单元。所以,如果你选择一个实例具有的每个虚拟核心2计算单元的对一个具有的每个核心一个的,你将能够在具有多个计算一个CPU上执行节点单位。不过,它看起来像经过2计算单元的计算能力,每个核心分割 这意味着你不会得到任何好处的多个内核。

One other detail: EC2 compute units are detailed per instance. For some instances you can get more "compute units" per virtual core. So if you pick an instance that has 2 compute units per virtual core versus one that has one per core, you will be able to execute node on a CPU that has more compute units. However, it looks like after 2 compute units the computing power is split per core which means you won't get any benefit from the multiple cores.

这篇关于Node.js的的CPU利用率在Amazon EC2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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