I have a java based application consisting of several pods (lets say 4) which is licensed by the sum of millicores (lets say we have purchased 2000mC of licenses). The application is running on a cluster host with 4000mC to support the memory required for the application. The application is bursty so each pod will want to use 2000mC at some point in time, but not at the same time. If the cpu limit is set to 2000mC per pod then over 4 pods our license liability would be 8000mC although in reality the host capacity would limit it to 4000mC. This is still double the licenses we have paid for. If we limit each pod to 500mC to ensure we never exceed 2000mC and stay within our license limit, the pods are under-resourced.
Is there a way to limit the CPU for a group of pods to allow any single pod to burst to the maximum limit while collectively not allowing them to exceed the maximum?
My suggestion would be to enable pod auto scaling. There are 2 types of it:
resources.requests.cpu
to start your pod with and in case the utilisation increases you can limit it using parameter resources.limits.cpu
. Resource managementCombination of both above methods will be ideal in your case.
A good strategy here would be to play with both requests and limit parameter of resources.
As an example for your case, you can use following configuration
resources.requests.cpu
- 750mCresources.limits.cpu
- 2000mCThis will allocate 3000m (740 x 4) CPU in the node, allowing additional 1000mC for CPU to burst.