Managing CPU Shares and Limits
The Parallels Server Bare Metal CPU resource control utilities allow you to guarantee any virtual machine or Container the amount of CPU time this virtual machine or Container receives. The virtual machine or Container can consume more than the guaranteed value if no other virtual machines and Containers are competing for the CPU and the
Note: The CPU time shares and limits are calculated on the basis of a one-second period. Thus, for example, if a virtual machine or Container is not allowed to receive more than 50% of the CPU time, it will be able to receive no more than half a second each second. To get a view of the optimal share to assign to a virtual machine or Container, check the current server CPU utilization: # vzcpucheck Current CPU utilization: 11142 Power of the node: 125504 The output of this command displays the total number of the so-called CPU units consumed by all running virtual machines and Containers and server processes. This number is calculated by Parallels Server Bare Metal with the help of a special algorithm. The above example illustrates the situation when the server is underused. In other words, the running virtual machines and Containers can receive more CPU time than is guaranteed to them.
In the following example, the
# pctl set MyVM --cpuunits 5000 --cpulimit 25 set cpuunits 5000 set cpulimit 25% The VM has been successfully configured.
To set the CPU time share and limit for Containers, just specify a Container ID instead of the virtual machine name and use the
# pctl set 101 --cpuunits 5000 --cpulimit 25 --save Saved parameters for Container 101 Setting CPU limits in megahertz
In the example above, you set the CPU limit for Container 101 and the
Now, imagine the situation when you migrate Container 101 to another server whose CPU power equals 4000 MHz. On this server, Container 101 can get 25% of 4000 MHz—that is, 1000 MHz. To deal with such situations, you can set CPU limits for virtual machines and Containers in MHz. Once you set the CPU limit in MHz, it remains the same, irrespective of the server total CPU power. For example, to make Container 101 and the
# pctl set MyVM ---cpulimit 500m set cpulimit 500 MHz The VM has been successfully configured. # pctl set 101 --cpulimit 500m --save Saved parameters for Container 101 |
||||
|