systemk
systemk copied to clipboard
Resource requests and limits
systemd has both mem and cpu accounting. The memory is specified in bytes and can be used from the podspec as is. The cpu however is done differently than in k8s. See https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
The problem is how to translate the cpu in the podspec into systemd values.
Here's the possible formats for Pod CPU resource requests and limits:
- an integer value, such as
2 - a fraction, such as
0.1 - an integer value in millis, such as
500m
All formats can be present in the same Pod spec and are directly translatable to milliseconds, which is supported by CPUQuotaPeriodSec, eg:
2==2.0==2000m0.1==100m
Do you see any limitation of just going w/ that attribute?
[ Quoting [email protected] in "Re: [virtual-kubelet/systemk] Resou..." ]
Here's the possible formats for Pod CPU resource requests and limits:
• an integer value, such as 2 • a fraction, such as 0.1 • an integer value in millis, such as 500m
All formats can be present in the same Pod spec and are directly translatable to milliseconds, which is supported by CPUQuotaPeriodSec, eg:
• 2 == 2.0 == 2000m • 0.1 == 100m
Do you see any limitation of just going w/ that attribute?
nope, if you say these are compatible it's pretty easy to convert and use.
Actually, I got it wrong when it comes to systemd primitives. CPUQuota is the field to use and it supports percentage alone. The conversion should be trivial, though.
Now, this only covers resource limits and not requests.
[ Quoting [email protected] in "Re: [virtual-kubelet/systemk] Resou..." ]
Actually, I got it wrong when it comes to systemd primitives. CPUQuota is the field to use and it supports percentage alone. The conversion should be trivial, though.
Now, this only covers resource limits and not requests.
don't think we can do requests though?
We'll also need to enable the CPU and memory accounting
One problem I see is that it seems that enabling accounting for one slice means parent and child slices are affected too which may not be desirable.