What does 'cpu' parameter mean in aws container service?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
In AWS container services like Amazon ECS (Elastic Container Service), the cpu
parameter plays a crucial role in determining how resources are allocated to containers. This parameter affects container performance, cost, and scalability.
Understanding the cpu
Parameter
The cpu
parameter specifies the number of CPU units allocated to a container. In Amazon ECS, CPU units are used to allocate CPU time on the underlying hardware. The allocation ensures containers get a fair share of compute resources based on their defined needs.
Technical Specifications
- CPU Units: The basic unit of CPU allocation in ECS. Traditionally, 1 vCPU (or one virtual core) is equivalent to 1,024 CPU units.
- Soft and Hard Limits: Specifying CPU units can set either soft or hard limits. Soft limits allow for burstable performance if there are spare resources, while hard limits enforce strict adherence to specified limits.
- Shared and Dedicated Resources: Containers can share CPU resources if specified under a common service, or they can be dedicated, ensuring exclusive access.
Example Scenario
Consider a web application running in AWS ECS. You might have a service that requires low latency and high compute power. For this service, you might allocate 2 vCPUs, which translate to 2048
CPU units in ECS configuration.
- Task CPU: Total CPU available to the task is the sum of the CPU units specified for each container within the task.
- EC2 vs Fargate: In ECS, tasks can run on EC2 instances or Fargate. For EC2 instances, the CPU allocation depends on the instance type. In Fargate, you specify and pay for the CPU units directly.
- Adequate CPU allocation ensures application runs efficiently.
- Over-allocation might lead to unnecessary costs.
- Under-allocation can cause throttling and hinder performance.
- In Fargate, an over-provisioned CPU leads to higher costs.
- Right-sizing tasks can contribute to substantial cost savings.
- Proper understanding of CPU requirements aids in designing scalable applications.
- Adjusting the
cpuparameter in response to monitoring data (e.g., CloudWatch metrics) helps maintain performance and cost balance over time.
Related reading
- What does Docker add to lxc-tools the userspace LXC tools?
- What does Kubernetes actually do?
- What does minikube docker-env mean?
- What does minikube docker-env mean?
- What does IOPS in Amazon EBS mean in practice?
- What does Kubernetes cronjobs startingDeadlineSeconds exactly mean?
- What is a dangling image and what is an unused image?
- What is a Kubernetes Manifest?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.