opensoftwareuser
opensoftwareuser

Reputation: 19

task running in ec2(spot-fleet) don't use more then 32GB of memory in ECS AWS

Why task(docker) don't use more than 32GB of ec2, with more than 32GB available in ec2 and task definition?

I don't know why docker doesn't use more than 32GB, because I use an ec2 with 122GB, and I declared in the task definition that the task has 122GB of RAM.

I execute a task with:

Task memory (MiB)121000
Task CPU (unit)3900

Running in ECS cluster, ec2(spot-fleet) x1e.xlarg with:

Task memory (MiB)122000
Task CPU (unit)4000

But when I see docker stats of this task running, the docker doesn't use more than 32GB memory.

Spot Fleet configuration

   amzn2-ami-ecs-gpu-hvm-2.0.20200706-x86_64-ebs [ami-082692cd7634df346]

   User-data

   #!/bin/bash
   echo "ECS_CLUSTER=tor-privoxy" >> /etc/ecs/ecs.config

Upvotes: 0

Views: 316

Answers (1)

Adiii
Adiii

Reputation: 59906

There is no such limitation of memory for ECS task, I will recommend removing memory restriction so your task will able to use Maximum memory of underlying EC2 instance if required.

Just use memoryReservation parameter and remove memory configuration from the task defintion.

memoryReservation
Type: integer

Required: no

The soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit; however, your container can consume more memory when needed, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first. This parameter maps to MemoryReservation in the Create a container section of the Docker Remote API and the --memory-reservation option to docker run.

container_definition_memory

Once you launch the container with this setting you will able to see the MEM USAGE / LIMIT where limit will show max memory of your EC2 instance in response of docker stats

enter image description here

Upvotes: 1

Related Questions