When it comes to Kubernetes resource allocation, CPU allocation is considered as a critical factor for application/pod performance.
According to Kubernetes spec, there is a way to do this using Limits and Requests.
Resource Management for Pods and Containers | Kubernetes
Assign CPU Resources to Containers and Pods | Kubernetes
But how do we make sure or derive a value for both CPU requests and limits.
I found below article:
For the love of god, stop using CPU limits on Kubernetes (updated)
Summary
Here is the FUN part :) .
Do pods always get the CPU requested by their CPU request ? Is it guaranteed?
Kubernetes CPU requests explained – Mechpen
https://en.wikipedia.org/wiki/Completely_Fair_Scheduler
How is kernel CFS working?
In CFS, every running entity, a process or a task group, has a virtual runtime (vruntime) which accounts for the entity's CPU usage.
The scheduling goal of CFS is to keep the vruntime of all running entities to be the same.
Thus the allocated CPU time of an entity is proportional to its weight
Each entity gets a portion of cpu.shares proportional to the task group's running load on the CPU
Summary:
CPU requests can't be guaranteed since CPU time depends on process load.
Kubernetes QoS classes (Quality of Service)
Configure Quality of Service for Pods | Kubernetes
What should be the best way to configure CPU limits and requests
Will adding K8S CPU limit reduce service performance? - SoByte
Set CPU requests and limits to the same value
Add an HPA (Horizontal Pods Auto scaling) that allows Pods to automatically scale up and down based on load.
Use circuit breaker pattern.
No comments:
Post a Comment