VMware Cloud Community
DheereshLodhi
Enthusiast
Enthusiast

CPU Affinity

Hi All,

If I will set CPU affinity what will happen to vmkernal’s ability to manage reservation and shares & reduce the resource sharing advantage that we get?

I mean after setting CPU affinity that perticual PCPU/Core will be used by perticular VM only all the time or if that VM is not doing anything in that case that PCPU will be used by other VMs?

Thanks in advance!

Dheeresh Lodhi

0 Kudos
5 Replies
DheereshLodhi
Enthusiast
Enthusiast

What in case if VM have got multiple vCPUs?

0 Kudos
FredPeterson
Expert
Expert

CPU affinity will not prevent other VMs from using that pCPU, nor will it effect any other resource settings such as reservations or shares.

It will however prevent vMotion.

0 Kudos
idle-jam
Immortal
Immortal

CPU affinity is being used only if there is a license issue with the application in the guest OS. if you would want to have control on your resource you're better off with resource pool.

If you insist of CPU affinity, you will need to set the current VM to use certain range of CPUs. and the rest of other VM CPU affinity to exclude what you have defined earlier. this makes management very complicated you will need to perform this for all new VM. and it might screwed up ESX's very efficient CPU scheduler.


iDLE-jAM | VCP 2, VCP 3 & VCP 4

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

0 Kudos
shrikanthegde
VMware Employee
VMware Employee

Affinity means that you can restrict the assignment of virtual machines to a subset of the available processors in multiprocessor systems. You do so by specifying an affinity setting for each virtual machine.

Before using affinity, consider following issues

Manual specification of virtual machine affinity degrade the scheduler's ability to balance load across processors.

Because CPU admission control does not consider affinity, a virtual machine with manual affinity settings might not always receive its full reservation.

When you move a virtual machine from one host to another, affinity might no longer apply because the new host might have a different number of processors.

The NUMA scheduler might not be able to manage a virtual machine that's already assigned to certain processors using affinity.

0 Kudos
RParker
Immortal
Immortal

What in case if VM have got multiple vCPUs?

Best way to use CPU affinity is DON'T. There is no reason to use it. ESX does a good job by itself to schedule CPU, the only thing that happens when you use CPU affinity is you force the VM to use ONLY CPU specified regardless if they are busy or not, which will adversely affect VM and balance on the host.

Best to avoid it.

0 Kudos