Open roleyfoley opened 4 years ago
@roleyfoley to provide specifics on implementation
So to implement this on both the service and task configuration at the top level we need a configuration option for the maximum CPU and Memory allocation.
That is applied on the TaskDefinitionResource https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html Under the Cpu and Memory Properties.
This has higher priority over the individual container allocations when fargate creates the task and allows for a shared memory or CPU allocation if you have multiple containers in the same task
From the making life easier when using hamlet perspective we should also check that the properties provided here ( if they are) are more than the memory and cpu allocations specified across the containers.
Expected Behaviour
To set a task level CPU and Memory limit which can be shared across all containers in the task
Current Behaviour
Task level CPU and memory usage is always calculated based on the max memory and CPU of the containers in the task
Possible Solution
Add a task level CPU and memory allocation configuration with an error if the container allocations go above the task allocation
Context
Fargate has a very strict set of task level memory and CPU configuration options. Since hamlet currently calculates this based on the number of containers it can be really difficult to find the right container level allocations to get the task value right ( i.e. trying to get 512, or 1024 from 3 containers )