1
votes

I have some trouble to understand the memory management on AWS ECS Fargate.

We can set a memoryReservation to our containers, and a "memory" limit on our task.

Why should i define reserverd memory on Fargate? I can understand it for EC2 instance types (to select an instance with enough free memory) but on fargate, aws should put the task on an Instance with enough free memory?

1

1 Answers

1
votes

Task Memory is the total memory available for all container ( its hard upper bound)

memoryReservation is a soft lower bound and container can use more memory if required.

This is helpful you have two or more container to in one task definition, to clarify this more we can look into this example

enter image description here

In this example, we allocate 128 MB for WordPress and 128Mb for MySQL, which become 256MB, which is half of the task level memory but we do not want a situation where container halt because of using max memory so we set hard memory limit to 512 and one container will reached to this the agent will the kill container.

enter image description here

deep-dive-into-aws-fargate