Can the memory checked inside the ecs fargate and the memory of the task definition be different?

0

I set 1 vcpu/ 2 memory in task definition in aws ecs fargate.

To check the memory of the app inside, I accessed the container directly through the aws exceute command and checked the memory through free and top, but it was set to 8gb. Why did this happen?

joker
已提问 1 年前447 查看次数
1 回答
1
已接受的回答

, it's possible that you're seeing the total memory available to the underlying infrastructure (the EC2 instance) rather than the memory limit set for your specific Fargate task. Fargate abstracts the underlying server infrastructure, but when you run commands like free or top inside a container, they report information about the underlying host, not the individual container.

The memory value that you set in the task definition is used by AWS to allocate resources and to enforce memory limits, but it might not be directly visible inside the container using tools like free or top.

To investigate further, you might consider monitoring the memory usage of your task using CloudWatch, or looking into container-level monitoring tools which are designed to report metrics in a containerized environment.

profile picture
专家
已回答 1 年前
profile picture
专家
已审核 11 天前
profile picture
专家
已审核 1 个月前
  • I said " it's possible that you're seeing the total memory available to the underlying infrastructure (the EC2 instance) ", but I don't understand the "infrastructure (the EC2 instance)" part, so I have an additional question. Can you say that infrastructure (the EC2 instance) is the server that actually operated fargate? fargate is confusing me as it doesn't use ec2 services.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则