3.2.11.2. Resource Management Options

Resource management options control the amount of resources a container may consume. If the setting has bar:lim after it than this setting requires specifying both barrier and limit values separated by colons.

NameDescription

--applyconfig <name>

This option lets you set the resource parameters for the container not one by one, but by reading them from the container sample configuration file. All container sample configuration files are located in the /etc/vz/conf directory and are named according to the following pattern: ve-<name>.conf-sample, so you should specify only the <name> part of the corresponding sample name after the --applyconfig option. Note that the names of sample configuration files cannot contain spaces. The --applyconfig option applies all the parameters from the specified sample file to the given container, except for the OSTEMPLATE, TEMPLATES, VE_ROOT, VE_PRIVATE, HOSTNAME, IP_ADDRESS, TEMPLATE, NETIF parameters (if they exist in the configuration sample file).

--cpuunits <units>

CPU weight. This is a positive integer number that defines how much CPU time the container can get as compared to the other virtual machines and containers running on the server. The larger the number, the more CPU time the container can receive. Possible values range from 8 to 500000. If this parameter is not set, the default value of 1000 is used.

--cpulimit {<percent>|<megahertz>}

CPU limit, in per cent or megahertz (MHz), the container is not allowed to exceed. This parameter is not set for newly created containers; so they can consume all free CPU power of the server. By default, the limit is set in percent. To set the limit in MHz, specify m after the value. When setting this parameter in per cent, keep in mind that one CPU core makes up 100%. So if the server has 4 CPU cores, the total CPU power will equal 400%.

--cpus <num>

Number of CPU cores defining the CPU limit for a container. The limit is calculated by multiplying the power of one CPU core by the number of the specified CPU cores. This option also defines the number of CPUs shown to container users. This parameter is not set for newly created containers; so they can consume all free CPU power of the server.

--cpumask <num>

CPU affinity mask. This mask defines the CPUs on the server that can be used to handle the processes running in the container. The CPU mask can be specified as both separate CPU index numbers (1,2,3) and CPU ranges (2-4,5-7).

--nodemask {<num>|all}

The NUMA node mask defining a NUMA node to bind the container to. Once you set the mask, the processes running in the container will be executed only on the CPUs that belong to the specified NUMA node.

--diskspace <amount>

Total disk space consumed by the container, in megabytes. You can use the following suffixes to specify measurement units:

  • G for gigabytes
  • M for megabytes
  • K for kilobytes
  • B for bytes

--quotaugidlimit {<0|<N>}

Enables (if set to a value other than 0) or disables (if set to 0) per-user/group quotas for further management with the standard Linux quota utility. Keep in mind the following:

  • Enabling per-user and per-group quotas for a container requires restarting the container.
  • If you delete a registered user but some files with their ID continue residing inside your container, the current number of UGIDs (user and group identities) inside the container will not decrease.
  • If you copy an archive containing files with user and group IDs not registered inside your container, the number of UGIDs inside the container will increase by the number of these new IDs.

--ioprio <num>

The container priority for disk I/O operations. The allowed range of values is 0-7. The greater the priority, the more time the container has for writing to and reading from the disk. The default container priority is 4.

--iolimit <num>

The bandwidth a container is allowed to use for its disk input and output (I/O) operations. By default, the limit is set in megabytes per second. You can use the following suffixes to specify measurement units:

  • G: sets the limit in gigabytes per second
  • M: sets the limit in megabytes per second
  • K: sets the limit in kilobytes per second
  • B: sets the limit in bytes per second

In the current version of OpenVZ, the maximum I/O bandwidth limit you can set for a container is 2 GB per second. The default I/O bandwidth limit for all newly created containers is set to 0, which means that no limits are applied to any containers.

--iopslimit <num>

The maximum number of disk input and output operations per second a container is allowed to perform. By default, any newly created container does not have the IOPS limit set and can perform so many disk I/O operations per second as necessary.

--rate <class>:_<Kbits>_

If traffic shaping is turned on, then this parameter specifies bandwidth guarantee for the container. The format is <class>_:_<Kbits>_ where <class> is the network class (group of IP addresses) and <Kbits> is the traffic bandwidth.

--ratebound <yes|no>

If set to "yes", the bandwidth guarantee is also the limit for the container and the container cannot borrow the bandwidth from the TOTALRATE bandwidth pool.

--memsize <size>

The amount of RAM that can be used by the processes of a container, in megabytes. You can use the following suffixes to specify measurement units:

  • G for gigabytes
  • M for megabytes
  • K for kilobytes
  • B for bytes

--memguarantee <size>

Sets a percentage of container’s RAM that said container is guaranteed to have. By default, set to 0%.

--swappages <pages>

The amount of swap space that can be used by the container for swapping out memory once the RAM is exceeded, in 4KB pages. You can use the following suffixes to specify measurement units:

  • G for gigabytes
  • M for megabytes
  • K for kilobytes
  • B for bytes

--swap <size>

The amount of swap space that can be used by the container for swapping out memory once the RAM is exceeded, in bytes. You can use the following suffixes to specify measurement units:

  • G for gigabytes
  • M for megabytes
  • K for kilobytes
  • B for bytes