gpt4 book ai didi

amazon-web-services - 有没有办法指定任务放置策略,以便将新任务放置在具有最多可用内存的实例上?

转载 作者:行者123 更新时间:2023-12-04 03:42:40 25 4
gpt4 key购买 nike

我在 ECS 集群中预留了多个 EC2 实例。目前,任务是按分布放置的。当某些实例的剩余内存很少而其他实例的内存很多时,这有时会导致问题。

有没有一种方法可以创建放置策略以将新任务放置在具有最多可用内存的实例上?

最佳答案

根据documentation你可以给调度器三种策略:

Amazon ECS supports the following task placement strategies:

binpackTasks are placed on container instances so as to leave theleast amount of unused CPU or memory. This strategy minimizes thenumber of container instances in use.

When this strategy is used and a scale-in action is taken, Amazon ECSwill terminate tasks based on the amount of resources that will beleft on the container instance after the task is terminated. Thecontainer instance that will have the most available resources leftafter task termination will have that task terminated.

random Tasks are placed randomly.

spread Tasks are placed evenly based on the specified value. Acceptedvalues are instanceId (or host, which has the same effect), or anyplatform or custom attribute that is applied to a container instance,such as attribute:ecs.availability-zone. Service tasks are spreadbased on the tasks from that service. Standalone tasks are spreadbased on the tasks from the same task group.

When this strategy is used and a scale-in action is taken, Amazon ECSwill select tasks to terminate that maintains a balance acrossAvailability Zones. Within an Availability Zone, tasks will beselected at random.

您似乎需要的似乎与 binpack 相反,因此您可能需要创建一个 custom scheduler .

或者,您可以使用 memoryReservation parameter 增加任务定义中所需的内存.这样一来,您的容器就应该获得运行所需的尽可能多的内存。

关于amazon-web-services - 有没有办法指定任务放置策略,以便将新任务放置在具有最多可用内存的实例上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65680345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com