英文:
AWS ECS placement memory issue
问题
我有3个ECS服务:
- Service512 - 512MB容器内存
- Service1280 - 1280MB容器内存
- Service768 - 768MB容器内存
它们分别部署在3个t3a.small实例上(每个实例还有2个守护进程,总共占用640MB内存)
无论部署策略如何,下一个Service512的部署将把它放在实例3上部署后的实例图,所以没有足够的空间来部署Service1280。是否需要实例4以确保有足够的空间来部署Service1280,或者是否有任何方法可以更有效地使用资源?
英文:
I have 3 ECS services:
- Service512 - 512mb container memory
- Service1280 - 1280mb container memory
- Service768 - 768mb container memory
They are placed on 3 t3a.small instances (each instance has also 2 daemons which grab 640mb in sum)
Regardless of placement strategy, next Service512 deployment will place it on instance 3
Instances diagram after deployment, so there will be no space to deploy Service1280. Is instance 4 required so there are enough space for Service1280 deployment, or are there any workaround to use resources more optimally?
答案1
得分: 0
所以问题发生在部署过程中。这实际上是完全预期的行为,因为ECS不会在新实例启动并健康之前注销和移除旧的Service512实例。它将要对Service1280执行相同的操作,这意味着您需要第四个实例,尽管在部署之后,第二个实例应该会被容量提供者自动删除。
您必须拥有足够的EC2实例来处理不仅所需的服务计数,还要在部署期间处理所需的健康任务百分比。如果您已配置容量提供者与EC2自动扩展组一起使用,它应该会自动创建Service1280部署所需的第四个实例,然后在部署之后,它应该会自动删除图表中的第二个实例,使您恢复为3个实例。
如果您希望ECS在部署新版本之前删除正在运行的任务,从而消除集群中临时第四个实例的需要,您可以更改部署设置的minimumHealthyPercent
和maximumPercent
值,但这当然会导致正在使用您服务的任何人都会出现停机时间。
英文:
So the problem is happening during deployments. This is actually entirely expected behavior, since ECS is not going to deregister and remove the old Service512 instance until the new instance is up and healthy. And it's going to want to do the same thing with the Service1280, which means you will need a 4th instance, although after the deployment the 2nd instance should be removed automatically by the capacity provider.
You have to have enough EC2 instances to handle not only the desired service count, but also the desired healthy task percentage during a deployment. If you have the capacity provider configured with an EC2 auto-scaling group, it should automatically create the 4th instance needed for the Service1280 deployment, and then after the deployment it should automatically delete the 2nd instance in your diagram, leaving you back with 3 instances.
You can change the deployment settings minimumHealthyPercent
and maximumPercent
values if you want ECS to delete the running task before deploying the new version, which would remove the need for a temporary 4th instance in your cluster, but of course that will incur down-time for anyone using your service.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论