Double vCPU units to the number configured are used in EKS Fargate

0

Hi We are running 500 instances in EKS Fargate profile. Here is the k8s configuration as per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html resources: limits: cpu: '2' memory: 16Gi requests: cpu: '2' memory: 16Gi Expectation: 1000 vCPUs should be used

Actual: Cloudwatch shows 2000 vCPUs getting consumed.

Cost is double than than estimated amount.

Any help is much appreciated.

Thanks

1 Answer
2

WS Fargate allocates CPU resources in terms of AWS vCPU units. For each vCPU, Fargate provides 1024 CPU units. The CPU value you specify in your pod configuration is converted to an equivalent number of vCPU units.

In your configuration, you've specified '2' for the CPU limit and request, which means you're requesting 2 vCPUs for each pod. If you're running 500 such instances, you would indeed expect a total of 1000 vCPUs to be used.

However, EKS on Fargate has a different method for vCPU calculation. As per the official AWS documentation, the actual number of vCPUs available for your application to use is 1/2 of what is specified in the CPU value. The remaining half is reserved for system-level processes.

This could be the reason why CloudWatch shows 2000 vCPUs getting consumed. Your application is using 1000 vCPUs (2 vCPUs for each of the 500 instances), and the same amount is being used by system-level processes, leading to a total of 2000 vCPUs.

Unfortunately, there is not much you can do about this since it's a feature of how EKS on Fargate works. If the cost is higher than what you're willing to pay, you might need to consider other options like using EC2 instances for your EKS clusters or optimizing your application to use fewer resources.

profile picture
EXPERT
answered a year ago
  • Thanks for your explanation. Can you please point me to the documentation that mentions about the system level processes that is accounted in the billing. Also will the memory also be doubled? In our case, we specified 16GB. Does it account for 32 GB ?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions