User Tools

Site Tools


технология_cgroup

Технология cgroup

cgroup v2

# lssubsys -a

# systemd-cgls
/apache2

# cat /sys/fs/cgroup/system.slice/apache2.service/memory.high

# echo 2000000 > /sys/fs/cgroup/system.slice/apache2.service/memory.high

# time curl 127.0.0.1

# systemctl edit --force --full my.slice
[Unit]
Description=My Slice
Before=slices.target

[Slice]
MemoryAccounting=true
MemoryLimit=64M
MemoryHigh=64M
CPUAccounting=true
CPUQuota=5%
TasksMax=4096
# systemctl edit apache2.service
[Service]
Slice=my.slice
# systemctl daemon-reload

# systemctl restart apache2.service

# systemd-cgls
/apache2

# cat /sys/fs/cgroup/my.slice/memory.high
  
# cat /sys/fs/cgroup/my.slice/cpu.max

cgroup v1 (Debian10/Ubuntu20)

# ls /sys/fs/cgroup/

# mkdir /sys/fs/cgroup/memory/group0

# echo $$ > /sys/fs/cgroup/memory/group0/tasks

# echo 1M > /sys/fs/cgroup/memory/group0/memory.limit_in_bytes
  или
# echo 512K > /sys/fs/cgroup/memory/group0/memory.limit_in_bytes

# vim anyfile
технология_cgroup.txt · Last modified: 2024/05/14 15:30 by val