If a physical server running ESX4 has 4 logical cores, how many virtual machines should in theory be able to have processor affinity set on them?
For example:
Service console - cpu 0
vm1 - cpu1
vm2 - cpu2
vm3 - cpu3
(that processor affinity should be used at all is the first question I realize but aside from that question)
Thanks
Hi,
In answer to your question - all VMs can have processor affinity set. Not a VM limit. Of course as you mentioned the first question is why you would be doing this in the first place.
*** UPDATE ***
Just remembered there is a limit to the number of vCPUs that can run on one core. With ESX 4.1 this is 25 so potentially this is the maximum number of single vCPU VMs you could have processor affinity set to the same core.
Kind regards.
the vmkernel recycle the CPU in every 20ms. therefore i would suggest letting vmkernel does it work for your instead of hard fixing the CPU. also the general practice is that each CPU core can handle about 3-5 VMs.
Also check out this article by Duncan on some of the other things that may come up with using processor affinity.
OK so if there are 4 cores and 5 vms and a service console, and processor affinity is required by higher up to be set for the vms (beyond my control), then would you set all vms to have affinity to three of the cores and let the service console have no affinity, or should the service console be set in that case to have unshared affinity to one of the cores?
Thanks
The Service Console console has processor affinity on cores 0 & 1. It also has a high priority level.
What problem is someone trying to solve? Once you set affinity you will need to manage it.
Don't know what problem is trying to be solved - only have an unqualified "just do it" from outside source. What is involved in managing it?
Processor affinity is used to solve some specific problems. Once you set affinity rules those VMs are bound to the cores you have assigned. One or more VMs may be idle but the idle core(s) can't be used for a busy VM. ESX(i) is no longer able to load balance CPU resources.
In additon to what DSTAVERT has mentioned here; I would recommend reading the following guides depending on your version of ESX:
www.vmware.com/pdf/vsphere4/r40/vsp_40_resource_mgmt.pdf (page 20 forward)
www.vmware.com/pdf/vsphere4/r41/vsp_41_resource_mgmt.pdf
These guides mention all the pros/cons for using CPU affinity.
Kind regards.
Setting affinity for all your VM's will almost 100% guarantee that you end up with poor performance unless there is some specific problem this solves. It would be an unusual problem.