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

问题描述

我试图在此处和,但我了解我需要特别了解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 mysingle-threaded app running on a container in this task will be able to fully use all this vCPUs as they are essentially only aportion 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 Iassigned 4vCPUs to a physical core that can freely process onethread (or even more with hyperthreading). Is my logic correct forthe 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:

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:

所以回答您的问题:

  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真正意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:11