Database Reference
In-Depth Information
cgroup.procs cpuset.memory_pressure_enabled release_agent
cpuset.cpu_exclusive cpuset.memory_spread_page tasks
cpuset.cpus cpuset.memory_spread_slab
cpuset.mem_exclusive cpuset.mems
cpuset.mem_hardwall cpuset.sched_load_balance
[root@server1 ~]#
This is the top-level hierarchy, or the hierarchy's root. Some of the properties in this directory are read-write, but
most are read-only. If you make changes to a property here, the change will be inherited by its siblings. The siblings
are the actual control groups which need to be created next:
[root@server1 cgroup]# cgcreate -t oracle:dba -a oracle:dba -g cpuset:/db1
[root@server1 cgroup]# cgcreate -t oracle:dba -a oracle:dba -g cpuset:/db2
It is indeed that simple! The cgcreate command will create control groups db1 and db2 for the cpuset controller,
as shown by the -g flag. The -a and -t flags allow the oracle account to administer and add tasks to the cpuset. Behind
the scenes you will see that it creates two subdirectories in the cpuset directory, each with its own set of virtual
configuration files. These control groups will inherit information from their parent, with the exception of the
cpuset.memory_pressure_enabled and release_agent fields. From an Oracle point of view, all that remains to be
done is to define which CPUs, and memory should be assigned to the cgroup. You use the cgset command to do so.
There is a confusingly large number of attributes that can be set, but luckily the documentation is quite comprehensive.
Following the example from the previous section, the first six “CPUs,” which are cores in reality, are mapped to db1; the
other six will be set to db2. The same happens for memory:
[root@server1 cpuset]# cgset -r cpuset.cpus=0-5 db1
[root@server1 cpuset]# cgset -r cpuset.mems=0 db1
[root@server1 cpuset]# cgset -r cpuset.cpus=6-11 db2
[root@server1 cpuset]# cgset -r cpuset.mems=2 db2
Note that the memory is allocated by NUMA node; the CPU cores are enumerated the same way the operating
system sees them. Further enhancements could include a decision on whether the CPUs should exclusively be
useable by the processes in a cgroup. In that case, if cpuset.cpu_exclusive is set to 1 and no other processes can utilize
the CPU—use this feature with care! The same applies for cpuset.mem_exclusive , but related to memory.
The manual way to start a process in a certain cgroup is called cgexec . Consider this example for starting an
Oracle database:
[oracle@server1 ~]$ cgexec -g cpuset:db1 /u01/app/oracle/product/12.1.0.1/dbhome_1/bin/sqlplus
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 28 13:49:51 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
...
Database opened.
SQL> exit
 
Search WWH ::




Custom Search