lxc-cgroup - Runtime config

 

目錄

  • lxc.payload.CT 與 lxc.monitor.CT
  • 設定
  • Runtime config memory

lxc.payload.CT 與 lxc.monitor.CT

 

In short: it exists to adhere to cgroup2 delegation requirements.

Path

  • /sys/fs/cgroup/<controller>/lxc.payload.<container-name>/
  • /sys/fs/cgroup/<controller>/lxc.monitor.<container-name>/

The monitor's and the container's cgroup will be placed on the same level in the corresponding cgroup hierarchy.

  • lxc.monitor is where the container manager lives
  • lxc.payload where the container lives
  • lxc.pivot is only needed on container exit to cleanup lxc.monitor and lxc.payload

 


設定

 

lxc-cgroup gets or sets thevalue of a state-object (e.g. 'cpuset.cpus')

state-object

  • cpuset.cpus
    -----------------------------------
  • memory.limit_in_bytes
  • memory.memsw.limit_in_bytes
  • memory.failcnt
  • memory.memsw.failcnt
  • ...

# 單位: K, M or G

lxc-cgroup -n vps0 <cgroup-name> <value>

Remark

ctName=mail

cat /sys/fs/cgroup/memory/lxc/$ctName/memory.memsw.limit_in_bytes

echo 700000000 > /sys/fs/cgroup/memory/lxc/$ctName/memory.memsw.limit_in_bytes

 


Runtime config memory

 

cd /sys/fs/cgroup/memory/lxc/lamp

  • memory.memsw.limit_in_bytes
  • memory.limit_in_bytes

Example:

Set max memory:

echo 2147483648> memory.limit_in_bytes

Set max swap:

echo 2g > memory.memsw.limit_in_bytes

可用單位 m(M), g(G)

* memory.memsw.limit_in_bytes > memory.limit_in_bytes

 

 


 

Creative Commons license icon Creative Commons license icon