Is there any reason not to give a VM an odd number of CPU cores?

6,085

In regards to stability: I can't think of any reason an odd number is less stable than an even one. I did an experiment in college where I ran a computationally intense multi-threaded program (in C) on a VM and changed the number of cores from 1 through 8 and measured the process run time. The results were mostly linear, as long as the process is configured to take full advantage of the number of cores. I can't think of any reason why the guest OS would have an issue either, nor should any guest processes since they get their processor time from the guest OS.

Performance might be slightly better if you stick to even numbers since some processor architectures are designed to share a cache between two cores. Hence, the odd core being used by the VM would have to share its cache with the host. But even that is a shaky theory since the VM software itself is never guaranteed to always get the same cores and cache between time slices. At this point, we are splitting hairs. For example, if you have a 4 core host, and you can't decide whether to give 2 or 3 cores to the VM, the slightly less optimum odd number of 3 will still run faster than a VM of 2. In this example, you might as well assign 4 cores to the VM. The host OS will only give up the time slices it can afford, so as long as you're not running huge processes on the host simultaneously, the VM should run fine.

Share:
6,085

Related videos on Youtube

D34DM347
Author by

D34DM347

I am a System Engineer for a large research university, mostly focused on managing data center infrastructure and virtualization tools. I primarily manage VMware, F5, and Linux products. I was formerly a VMware IT Academy instructor.

Updated on September 18, 2022

Comments

  • D34DM347
    D34DM347 over 1 year

    I'm worried that setting the number of CPU cores to an odd number could reduce performance or stability. Are there any situations where this could be true?