The problem is similar to this one, but there are 2 nuances.
If I switch to user with
sudo -u testuser -i
then load CPU using stress utility, CPUQuota doesn't take effect.If I login via SSH as a
testuser
, run some intensive task and then it works as expected.
My CPUQuota config
/etc/systemd/system.control/user-1003.slice.d/50-CPUQuota.conf
[Slice]
CPUQuota=33%
systemctl show -p DefaultCPUAccounting
DefaultCPUAccounting=yes
Distribution: Debian 12 latest. Ubuntu 22.04 also affected by this.
How do I debug this issue to get any clues?
P.S. Issue posted on systemd GitHub repo
I've found a solution. You should implement some kind of a user service wrapper around the slice file. Just like it's done here.
After that everything works as expected.