cgroup_manage.sh
Function
Format
cgroup_manage.sh [-c xxx] [-g xxx] [-p xxx] show
cgroup_manage.sh [-l xxx] [-s xxx] install
cgroup_manage.sh -p xxx -v xxx oom_adj
cgroup_manage.sh -g xxx [-l xxx] [-s xxx] [-i xxx] start
cgroup_manage.sh -g xxx [-l xxx] [-s xxx] update
cgroup_manage.sh uninstall
cgroup_manage.sh [-i xxx] end
Parameters
Parameter |
Description |
Value |
---|---|---|
-c xxx | Specifies the cgroup subsystem. "xxx" indicates the subsystem name. Only "memory" is supported, and "memory" is used by default. | Only "memory" is supported. |
-g xxx | Specifies the cgroup name. "xxx" indicates the cgroup name, which is specified by the user. | Control group name. |
-p xxx | Specifies the process name. "xxx" indicates the process name, which is specified by the user. | Process name. |
-l xxx | Specifies the hard upper limit of memory usage of the memory subsystem. "xxx" is used to specify the hard upper limit of memory usage of the specified cgroup. For example, "-l 240M" indicates that the hard upper limit of memory usage of the specified cgroup is 240 MB. When parameters "-l" and "-s" are not used, parameters are read from "product.ini" by default. | 0-0xFFFFFFFFFFFFFFFF bytes. |
-s xxx | Specifies the soft upper limit of memory usage of the memory subsystem. "xxx" is used to specify the soft upper limit of memory usage of the specified cgroup. For example, "-s 200M" indicates that the soft upper limit of memory usage of the specified cgroup is 200 MB. When parameters "-l" and "-s" are not used, parameters are read from "product.ini" by default. | 0-0xFFFFFFFFFFFFFFFF bytes. |
-v xxx | Sets the weight of a process being selected during the omm process. "xxx" indicates the value of "oom_adj". The larger the value, the more likely the process to be selected and killed. "-17" indicates the process will never be selected during the omm process. | [-17,15] |
-i xxx | Specifies the process PID. "xxx" indicates the process PID. In the "start" command, this parameter indicates that the PID is added to the specified cgroup. In the "end" command, this parameter indicates that the PID is removed from the specified cgroup. | Process ID. |
Usage Guidelines
The "cgroup_manage.sh show" command is used to query statistics on memory cgroups.
Exercise caution when using the other commands.
Example
-
Query the cgroup subsystem memory information specified by -c.
Storage: minisystem> cgroup_manage.sh -c memory show 1 ------------show memory subsystem------------- 2 usage max_usage limit soft_limit failcnt cgroup 3 772M120K 0 Invalid Invalid 0 /cgroup/memory 4 93M640K 97M8K 4G420M 3G691M 0 /cgroup/memory/cg_root 5 13M64K 13M504K 60M 50M 0 /cgroup/memory/cg_root/antivirus 6 5M304K 8M728K 240M 200M 0 /cgroup/memory/cg_root/ccdb 7 72M112K 75M424K 650M 580M 0 /cgroup/memory/cg_root/omm 8 3M160K 4M292K 700M 700M 0 /cgroup/memory/cg_root/protocol 9
-
Query the process information specified by -p.
Storage: minisystem> cgroup_manage.sh -p ccdb_server show 1 -----------show process info----------------- 2 cmd: /OSM/bin/ccdb_server 3 cgroup: /cg_root/ccdb 4 oom_adj: 0 5 Pid VmSize RSS Name 6 25612 370432 kB 5092 kB ccdb_server 7
-
Query the statistic of cgroup specified by -g.
Storage: minisystem> cgroup_manage.sh -g ccdb show 1 -----------show cgroup property--------------- 2 memory_usage: 4M912K 3 memory_max_usage: 8M764K 4 memory_limit: 240M 5 memory_soft_limit: 200M 6 memory_failcnt: 0 7 Pid VmSize RSS Name 8 25612 370432 kB 5092 kB ccdb_server 9
-
Modify the hard or soft upper limit of memory usage of a specified cgroup.
Storage: minisystem> cgroup_manage.sh -g diagnose -l 100M -s 80M update 1 update cgroup diagnose limit:100M soft_limit:80M success
System Response
The following table describes the parameter meanings.
Parameter |
Meaning |
---|---|
usage | Memory usage. |
max_usage | Maximum memory usage. |
limit | Hard upper limit of memory usage of the cgroup. |
soft_limit | Soft upper limit of memory usage of the cgroup. |
failcnt | Count of memory application failures. |
memory_failcnt | Count of memory application failures. |
cgroup | Control group. |
cmd | Command for starting the process. |
oom_adj | Priority of the process being selected during the oom process. |
Pid | Process ID. |
VmSize | Virtual memory size. |
RSS | Physical memory size. |
Name | Process name. |
memory_usage | Memory usage. |
memory_max_usage | Maximum memory usage. |
memory_limit | Hard upper limit of memory usage of the cgroup. |
memory_soft_limit | Soft upper limit of memory usage of the cgroup. |