我如何计算容器和EC2的适当规格?

huangapple go评论66阅读模式
英文:

How can I calculate the appropriate spec for container and EC2?

问题

I am using ECS on EC2.

我正在在EC2上使用ECS。

I met this problem when deploying.

在部署时,我遇到了这个问题。

service myapp-dev-service was unable to place a task because no container instance met all of its requirements. The closest matching container-instance f246f9a525a542229c060c62a9529314 is missing an attribute required by your task. For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.

由于没有容器实例满足其所有要求,服务myapp-dev-service无法放置任务。最接近匹配的容器实例f246f9a525a542229c060c62a9529314缺少您任务所需的属性。有关更多信息,请参阅Amazon ECS开发者指南中的故障排除部分。

My instance is t2.small.

我的实例是t2.small

And I have one task definition which has two containers.

我有一个任务定义,其中包含两个容器。

const djangoContainer = taskDefinition.addContainer('adminContainer', {
image: djangoImage,
containerName:myapp-django-container,
memoryLimitMiB: 256,
})
const nginxContainer = taskDefinition.addContainer('nginxContainer', {
image: nginxImage,
containerName:myapp-nginx-container,
memoryLimitMiB: 256,
})

我有一个任务定义,其中包含两个容器。

So I guess memory of t2.small(2GB) is enough for this task definition.

所以我猜测t2.small(2GB)的内存对于这个任务定义足够了。

Why this happens? and how can I calculate and decide the node size?

为什么会发生这种情况?我该如何计算和决定节点的大小?

英文:

I am using ECS on EC2.

I met this problem when deployng.

service `myapp-dev-service` was unable to place a task because no container instance met all of its requirements. The closest matching container-instance f246f9a525a542229c060c62a9529314 is missing an attribute required by your task. For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.

My instance is t2.small

And I have one taskdefinition which has two containers.

const djangoContainer = taskDefinition.addContainer('adminContainer', {
  image: djangoImage,
  containerName:`myapp-django-container`,
  memoryLimitMiB: 256,
})
const nginxContainer = taskDefinition.addContainer('nginxContainer', {
  image: nginxImage,
  containerName:`myapp-nginx-container`,
  memoryLimitMiB: 256,
})

So I guess memory of t2.small(2GB) is enough for this task definition.

Why this happen? and how can I calculate and decide the nodes size??

答案1

得分: 1

你存在内存限制问题。在Amazon ECS中,内存可以在任务级别和每个容器级别进行定义。如果您指定了硬限制(内存),如果容器尝试超过该限制,容器将被终止。如果您指定了软限制(memoryReservation),ECS会为容器保留该内存量;然而,容器可以请求达到硬限制(如果指定)或容器实例上所有可用内存的总和,以先达到的为准。如果您同时指定了两者,硬限制必须大于软限制。阅读更多分配ECS限制

英文:

You have problem with memory limits. In Amazon ECS, memory can be defined at both the task level and at each container level. If you specify a hard limit (memory), your container will be killed if it attempts to exceed that limit. If you specify a soft limit (memoryReservation), ECS reserves that amount of memory for your container; however, the container can request up to the hard limit (if specified) or all of the available memory on the container instance, whichever is reached first. If you specify both, the hard limit must be greater than the soft limit.
Read more allocate ECS limits

huangapple
  • 本文由 发表于 2023年5月13日 13:00:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241142.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定