-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work on ECS (nested cgroups) #66
Comments
Thank you for saving me the time lol |
For anyone else who stumbles across this like I did. I also experienced the issue of trying to auto set GOMAXPROCS using automaxprocs in ECS. Unfortunately that won't work because just like @blampe mentioned the containers I did however manage to find a workaround. It aint pretty but what you can do as part of your app startup is leverage the ECS Metadata endpoint which you can reference as part of an env variable to pull the container and task cpu limit. You can then use the cpu limit to set GOMAXPROCS. I've put together a repo of an example for anyone who is interested: rdforte/gomaxecs/ |
is it solved? |
@recrack you can try gomaxecs if you are looking at resolving the GOMAXPROCS issue in ECS. You can see how Otel has implemented it here along with uber's automaxprocs if you wanted a solution for k8s and ECS otherwise the Quick Start for gomaxecs will suffice. |
Apparently, the cgroups are not correctly set on ECS and the CFS quota cannot be determined by automaxprocs. See uber-go/automaxprocs#66. Signed-off-by: Charith Ellawala <[email protected]>
Apparently, the cgroups are not correctly set on ECS and the CFS quota cannot be determined by automaxprocs. See uber-go/automaxprocs#66. Signed-off-by: Charith Ellawala <[email protected]> Signed-off-by: Charith Ellawala <[email protected]>
Unlike Kubernetes, ECS only allows you to apply a CPU quota at the task (pod) level. Containers in the task are always unbounded.
For example, when
cpu: 1024
(1 vCPU) is provided in the task definition it gets the expected quota:But providing
cpu: 1024
to a container inside the same task doesn't have the same effect:(The container's
cpu
value is only used for placement and CPU shares, but doesn't actually affect CPU scheduling aws/containers-roadmap#1862.)If the container is using
automaxprocs
it only sees a quota of-1
and defaults to using all ofruntime.NumCPU
, even though the task's cgroup clamps it to 1 vCPU.(I'm using cgroups v1 as an example here but the same is true with v2 as well, if you happen to be using an AL2023 AMI.)
It seems like the library could climb up the mount point to find quotas belonging to parents, but this is suboptimal if the task has more than one container.
I'm mostly writing this down to help anyone else avoid this rabbit hole.
The text was updated successfully, but these errors were encountered: