Virtual Machine -- 2 cores at 100% or 4 cores at 50%?

vaconcamp

Honorable
Sep 1, 2012
17
0
10,560
I was wondering what the best setup for a VM was, I have an i5-4590 (quad core) and want to run a Windows 7 VM but am wondering if it would be better to have 4 cores run at 50% efficiency or 2 cores at 100%. What would give me the best performance on the guest and the least stress on the host?
 
Solution


If you're talking about scheduling quotas, leave them at 100% unless you're running a shared VPS service. Most modern operating systems are guest-aware (they can tell that they are being virtualized) and will behave quite nicely. If the guest doesn't need CPU time it won't ask for any.

As far as number of CPUs go, I would not advise allocating more than half the total number of logical processors available on the host (Hyperthreading helps...

Pinhedd

Distinguished
Moderator


If you're talking about scheduling quotas, leave them at 100% unless you're running a shared VPS service. Most modern operating systems are guest-aware (they can tell that they are being virtualized) and will behave quite nicely. If the guest doesn't need CPU time it won't ask for any.

As far as number of CPUs go, I would not advise allocating more than half the total number of logical processors available on the host (Hyperthreading helps a lot here). Scheduling uniprocessor guests is easy, but scheduling multiprocessor guests is tricky. In particular, the VMM needs to ensure that logical processors enter the guest state (virtual processor) at more or less the same time and return to the host state at more or less the same time. If one of the logical processors doesn't enter in time (for example, it's running a high priority task on the host) the other virtual processors will be forcibly descheduled.
In extreme cases, it's possible for an overprovisioned guest to experience CPU starvation simply because the VMM can't get a sufficient number of host logical processors to enter the guest state within the time window.
Since you have a quad core microprocessor without hyperthreading you should allocate at most 2 virtual processors to any one particular virtual machine.
 
Solution