Fargate中的vCPU真正意味着什么? [英] What vCPUs in Fargate really mean?

查看:124
本文介绍了Fargate中的vCPU真正意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在此处

I was trying to get answers on my question here and here, but I understood that I need to know specifically Fargate implementation of vCPUs. So my question is:

  1. 如果我为任务分配了4个vCPU,这意味着我 在此任务中运行在容器上的单线程应用将能够完全使用所有这些vCPU,因为它们实际上只是一个 我可以使用的处理器核心时间的一部分?
  2. 比方说,我为任务分配了4个vCPU,但在技术层面上,我 将4个vCPU分配给可以自由处理一个的物理内核 线程(甚至在超线程中更多).我的逻辑是否正确 Fargate案?
  1. If I allocate 4 vCPUs to my task does that mean that my single-threaded app running on a container in this task will be able to fully use all this vCPUs as they are essentially only a portion of time of the processor's core that I can use?
  2. Let's say, I assigned 4vCPUs to my task, but on a technical level I assigned 4vCPUs to a physical core that can freely process one thread (or even more with hyperthreading). Is my logic correct for the Fargate case?

p.s.这是一个node.js应用程序,它与多个相互交互的播放器运行会话,因此我确实想提供一个具有最大容量的单个 node.js进程.

p.s. It's a node.js app that runs session with multiple players interacting with each other so I do want to provide a single node.js process with a maximum capacity.

推荐答案

Fargate在后台使用ECS(弹性容器服务)来编排Fargate容器.反过来,ECS依靠EC2提供给主机容器的计算资源.根据AWS Fargate 常见问题解答:

Fargate uses ECS (Elastic Container Service) in the background to orchestrate Fargate containers. ECS in turn relies on the compute resources provided by EC2 to host containers. According to AWS Fargate FAQ's:

Amazon Elastic Container Service(ECS)是一种高度可扩展的高性能容器管理服务,它支持Docker容器,并允许您在Amazon EC2实例的托管集群上轻松运行应用程序 ...

Amazon Elastic Container Service (ECS) is a highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances ...

ECS使用Fargate提供的容器来自动扩展,负载均衡和管理容器的调度

ECS uses containers provisioned by Fargate to automatically scale, load balance, and manage scheduling of your containers

这意味着vCPU本质上与EC2实例vCPU相同.从 docs :

This means that a vCPU is essentially the same as an EC2 instance vCPU. From the docs:

Amazon EC2实例支持Intel超线程技术,该技术使多个线程可以在单个Intel Xeon CPU内核上同时运行.除T2实例外,每个vCPU都是Intel Xeon CPU内核的超线程.

Amazon EC2 instances support Intel Hyper-Threading Technology, which enables multiple threads to run concurrently on a single Intel Xeon CPU core. Each vCPU is a hyperthread of an Intel Xeon CPU core, except for T2 instances.

所以回答您的问题:

  1. 如果将4个vCPU分配给单个线程应用程序-它只会使用一个vCPU,因为vCPU只是单个内核的超线程.

  1. If you allocate 4 vCPUs to a single threaded application - it will only ever use one vCPU, since a vCPU is simply a hyperthread of a single core.

当您选择4个vCPU时,实际上是将4个超线程分配给单个物理核心.因此,您的单线程应用程序仍将仅使用单个内核.

When you select 4 vCPUs you are essentially assigning 4 hyperthreads to a single physical core. So your single threaded application will still only use a single core.

如果您想对CPU资源进行更精细的控制(例如分配多个内核(可以由一个线程的应用程序使用)),则可能必须使用EC2启动类型(并管理您自己的服务器),而不是使用Fargate.

If you want more fine grained control of CPU resources - such as allocating multiple cores (which can be used by a single threaded app) - you will probably have to use the EC2 Launch Type (and manage your own servers) rather than use Fargate.

这篇关于Fargate中的vCPU真正意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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