Proxmox OpenVZ CPU units
Category : How-to
OpenVZ containers have a mechanism in place toÂ prioritiseÂ CPU resource assignment. You can make sure that your most critical guests have the CPU resource they require.
In Proxmox you can set the CPU units attribute through the web GUI by clicking on the container to change, selecting the Options tab and double clicking CPU units.
This setting dictates the minimum amount of CPU time, or CPU units, the guest will have. Before you change the setting you will need to find out how many CPU units your system hasÂ available. Run vzcpucheck to find out how many CPU units you have available.
Power of the node: 1360020 indicates the maximum CPU units your system has available for use. You can now distribute these CPU units to your guests however, this setting should be used as a minimum amount of CPU time your guest will have. The guest will only use the allocated resource if it needs it, otherwise will be available for other guests.
For example, if you wanted to give a container 20% of the total CPU time, you would would enter 272004.
1360020 * 20% = 272004 (Total units) * (desired %)
This value can be entered into the Proxmox web GUI under Options on the container screen.
If you prefer the command line, on the host you can use the vzctl set command:
vzctl set 101 --cpuunits 272004 --save