[AWS Batch] [request]: Add Hard CPU Limits to AWS Batch on ECS/EKS
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
We'd like to have the ability to set a hard limit so jobs running in containers are restricted to the number of CPU cores requested, preventing them from accessing additional cores beyond the allocated amount.
**Which service(s) is this request for?**
AWS Batch on ECS/EKS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
The problem involves resource contention in shared EC2 environments caused by the inability to enforce hard CPU limits for AWS Batch jobs. Currently, the CpuShares setting provides relative prioritization but does not enforce strict CPU restrictions. We’ve observed that the container’s NanoCpus value is always set to 0, indicating no hard CPU quota is applied, which results in Batch jobs being able to access all CPU cores on the EC2 instance.
This behavior is problematic because it leads to resource contention between jobs running on the same EC2 instance. More critically, it causes errors in our workloads due to the unpredictable access to CPU resources. Strict CPU quotas would improve performance predictability and ensure that each job is given only the number of cores it specifically requests.
**Are you currently working around this issue?**
Currently, there are no direct workarounds available to enforce strict CPU quotas within AWS Batch. While we've modified our code to limit CPU usage to a specific number of cores, the issue persists when running third-party containers that we do not control.
Contributor guide
Research direction
Start by investigating how AWS Batch on ECS/EKS maps requested CPUs to container settings, focusing on the reported NanoCpus value of 0 and the current CpuShares behavior. Confirm whether hard CPU quotas can be exposed for these environments and define completion as jobs being restricted to their requested CPU cores without affecting other workloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, kubernetes
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100