setting CPU Limit for linux user not worked?

66 Views Asked by At

basically i want to limit my users for cpu usage.

i have user with 1002 id and created a user-1002 slice file

i have created

mkdir /sys/fs/cgroup/user.slice/user-1002.slice

then ranned below commands for limiting cpu usage for my user

systemctl set-property user-1002.slice CPUAccounting=yes
systemctl set-property user-1002.slice CPUQuota=20%

after that for testing purpose i have used stress command to verify weather my user is having limit for cpu usage or not

stress --cpu 2 --timeout 60s

then used top command to monitor cpu usage in that i was getting 100 % usage for cpu

enter image description here

i was trying to limit cpu usage for linux users but after performing all actions for cpu limit, i have not got cpu usage limitation for my user.

0

There are 0 best solutions below