CPU questions

gkovacs

Renowned Member
Dec 22, 2008
512
50
93
Budapest, Hungary
I have a couple of questions regarding CPU allocation between VEs.

1. What does the CPU Units value mean for OpenVZ (and is it different for KVM)?

2. Do the KVM and VZ CPUUnits values respect each other across, or are completely independent?

3. I noticed there is a --cpus 1 argument when creating an OpenVZ VE. Exactly what does it do? Does it mean that one particular VE can use only one CPU core? (If I view /proc/cpuinfo in the VE it shows all four cores of my CPU).

Merry Christmas and a Happy New Year to the Proxmox team and all fellow users!
 
1. What does the CPU Units value mean for OpenVZ (and is it different for KVM)?

CPU weight for a container. Argument is positive non-zero number,
passed to and used in the kernel fair scheduler. The larger the
number is, the more CPU time this container gets. Maximum value is
500000, minimal is 8. Number is relative to weights of all the
other running containers. If cpuunits are not specified, default
value of 1000 is used.


Same meaning for OpenVZ and KVM.

2. Do the KVM and VZ CPUUnits values respect each other across, or are completely independent?

They respect each other (kernel fair scheduler settings).

3. I noticed there is a --cpus 1 argument when creating an OpenVZ VE. Exactly what does it do? Does it mean that one particular VE can use only one CPU core? (If I view /proc/cpuinfo in the VE it shows all four cores of my CPU).

Unfortunately --cpus does not work for OpenVZ currently. We still wait until it gets implemented by the OpenVZ team (for kernel 2.6.24). So containers always use all available CPUs at the moment.

- Dietmar
 
CPU weight for a container. Argument is positive non-zero number,
passed to and used in the kernel fair scheduler. The larger the
number is, the more CPU time this container gets. Maximum value is
500000, minimal is 8. Number is relative to weights of all the
other running containers. If cpuunits are not specified, default
value of 1000 is used.


Same meaning for OpenVZ and KVM.



They respect each other (kernel fair scheduler settings).



Unfortunately --cpus does not work for OpenVZ currently. We still wait until it gets implemented by the OpenVZ team (for kernel 2.6.24). So containers always use all available CPUs at the moment.

- Dietmar

Hi,

I was just searching for the answers to my question and I found this thread. Hopefully you don't mind me bumping it.

So CPU Units is just a value that is taken into consideration when having multiple VMs? So say I have 5 VMs using CPUs =1 core, and different CPU Units values:

VM 1 = 8
VM 2 = 100
VM 3 = 500
VM 4 = 1000
VM 5 = 3000

If all of them are running 100% of the CPU, will it in reality "throttle" the other VMs in any way to avoid the host itself (proxmox) overloading? Given that its a QUAD core and I assigned only 1 core to all those machines load should never go above 25% right? (assuming 1 core 100% CPU use)
 
I would actually like to bring a small correction here with respect to CPU Units on OpenVZ:

1. CPU Units of 1000 does not mean that you get 1/10th of the cpu time for the particular vm

2. The maximum units is not 500000

CORRECTION:
According to the OpenVZ manual: CPU units are the number of CPU time you guaranty to a VM.

You first need to find out how many CPU units you have in your system by running:

Code:
vzcpucheck

In my case I get:

Code:
vzcpucheck
Current CPU utilization: 14000
Power of the node: 906755

Now if I give 1000 units to a VM on this node, it means that this OpenVZ VM is getting 1000 divided by 906755 and multiplied by 100 = 0.1% of the CPU time.

So if I want to give 5 percent of guaranteed time to my VPS, I would enter CPU Units = 45337

---
I hope this clarifies things.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!