Virtualization and CPUs


In an attempt to better determine how to leverage more CPU power for our virtual server, I started searching to web for beneficial information on adjustments and considerations to make. I was particularly concerned with Hyperthreading at the time. I found a good article by Intel which covers this and more. Check the resources section at the bottom of this article to get more information since they cover many important consideration. I will provide a brief conclusion from information I gained from this article.

The Many Types of CPUs

Many virtualization software will by default not set a processor affinity to the Virtual Machine. What this allows is for the Virtual Machine to have access to all available “CPUs” accessible to the Virtual Machine. This includes physical CPUs, individual CPU cores, and Hyperthreaded CPUs. The benefit to this is that a thread created within the virtual machines will get scheduled by the operating system to the next available CPU visible to the operating system, reducing the wait to execute a thread and potentially improve distributing and balancing resource. This of course is affected by how the Virutal Machines threads are handled by the virtualization software. A drawback noticed is since threads can be scheduled between multiple CPU resources, they may not share the same Caches, and therefore can lead to more occurrences of Cache misses. This reduces the effectiveness of caching.

My Conclusion

With what I believe to be sufficient testing, I left the default CPU affinity to allow for all CPUs available to the operating system to be scheduled appropriately. Of course with testing, others may find some advantages to limit affinity to certain CPU resources. Please also read the following intel article since they have good examples and diagrams that will fill any gaps and better help you with making your own conclusions.


Leave a Reply