GEO IP Locations in: France IP Location United Kingdom IP Location Germany IP Location Italy IP Location Netherlands IP Location Spain IP Location United States of America IP Location Canada IP Location
Home » VPS » CPU, RAM and IO Limits whith Cgroups and Systemd

CPU, RAM and IO Limits whith Cgroups and Systemd

Systemd made imposing a limits on a customer account so they do not bring the server down relatively easy.

You just need to ensure that it cgroups are fully enabled .

 

nano /etc/default/grub

 

find GRUB_CMDLINE_LINUX=”  ” and add the systemd.unified_cgroup_hierarchy=1 there, save

 

update-grub && reboot

 

Next execute

systemctl set-property user.slice CPUAccounting=1

systemctl set-property user.slice MemoryAccounting=1

systemctl set-property user.slice IOAccounting=1

systemctl daemon-reload

systemctl restart user.slice

 

Create slices for every user on the server with their limits

/etc/systemd/system/user-1000.slice

where 1000 is the UID and set there your limits

 

[Slice]

CPUQuota=100%

MemoryMax=2G

IOReadBandwidthMax= / 15M

IOWriteBandwidthMax= / 15M

IOReadIOPSMax= / 1024

IOWriteIOPSMax= / 1024

 

CPUQuota 100% is equal to 1 CPU core (HT)

Memory Limit and Block IO can be K,M,G …

/ is device or just paht /var/log for example

Some varibles differs from the DA forum post as i finally managed to find updated docs

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*