User`s guide

Managing Resources 54
cpuunits
This is a positive integer number that determines the minimal guaranteed
share of the CPU time the corresponding Virtual Private Server will
receive.
V
cpulimit
This is a positive number indicating the CPU time in per cent the
corresponding VPS is not allowed to exceed.
V
The OpenVZ CPU resource control utilities allow you to guarantee any Virtual Private Server
the amount of CPU time this Virtual Private Server receives. The Virtual Private Server can
consume more than the guaranteed value if there are no other Virtual Private Servers competing
for the CPU and the
cpulimit parameter is not defined.
To get a view of the optimal share to be assigned to a Virtual Private Server, check the current
Hardware Node CPU utilization:
# vzcpucheck
Current CPU utilization: 5166
Power of the node: 73072.5
The output of this command displays the total number of the so-called CPU units consumed by
all running Virtual Private Servers and Hardware Node processes. This number is calculated by
OpenVZ with the help of a special algorithm. The above example illustrates the situation when
the Hardware Node is underused. In other words, the running Virtual Private Servers receive
more CPU time than was guaranteed to them.
In the following example, Virtual Private Server 102 is guaranteed to receive about 2% of the
CPU time even if the Hardware Node is fully used, or in other words, if the current CPU
utilization equals the power of the Node. Besides, VPS 102 will not receive more than 4% of the
CPU time even if the CPU is not fully loaded:
# vzctl set 102 --cpuunits 1500 --cpulimit 4 --save
Saved parameters for VPS 102
# vzctl start 102
Starting VPS ...
VPS is mounted
Adding IP address(es): 192.168.1.102
VPS start in progress...
# vzcpucheck
Current CPU utilization: 6667
Power of the node: 73072.5
Virtual Private Server 102 will receive from 2 to 4% of the Hardware Node CPU time unless the
Hardware Node is overcommitted, i.e. the running Virtual Private Servers have been promised
more CPU units than the power of the Hardware Node. In this case the VPS might get less than
2 per cent.