16

I already looked at this thread: Hyper-V and Hyper-threading: On or off?, but the only answer is Windows specific....

I am building a VM server (using Proxmox VE if that makes a difference) and was wondering about how hyper threading can affect virtual machines...

Specifically, if I max out the number of virtual machines, would hyper threading help, or hurt performance?

Also, the largest virtual machines will be a Terminal Server with ~30 clients (4 Cores/8 GB of RAM), and a file server if that helps.

Update: The server is a Dell R410 with a 1TB RAID 10, 32 GB of RAM and Dual Intel Xeon E5530 (I am not sure about the exact model, but it was an E55xx with 2+ Ghz)

Update: Most VMs will be on KVM.

Soviero
  • 4,306
  • 7
  • 34
  • 59

3 Answers3

12

In general, I leave HyperThreading ON for VM host servers (VMWare ESXi, KVM, HyperV, etc.). This applies to Intel Nehalem and newer CPUs (5500-series and greater). Additional threads available for scheduling multiple VMs.

You may also want to reevaluate the sizing of your guest systems. Typically, it's best to start small on the CPU allocation with virtual machines. Since you're talking about a terminal server, I'd actually move that to 2 virtual CPUs rather than 4 vCPUs. It's easier for the hypervisor to schedule CPU time for VMs with smaller core counts. RAM is still critical, though, so make sure to make plenty available.

See: http://omtconcepts.com/wp/?p=14

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • How exactly are two threads **faster** than four? – Soviero Feb 26 '12 at 06:43
  • 3
    Not faster... Easier to schedule. See my edit. The machine you mention will have 8 total cores (16, with HyperThreading). Trying to find the resources to schedule a 4-vCPU guest is more difficult than 2-vCPUs. You'll have more contention (and thus, lower performance). If you plan to run other virtual guests on this server, it makes sense to use 1 and 2 vCPU guests. – ewwhite Feb 26 '12 at 06:51
  • 3
    Your point about scheduling only applies to hypervisors that do "gang scheduling" where they attempt to run some approximation of "all or none" of the virtual processors at the same time. For hypervisors that do this, adding more virtual processors will make the VM harder to schedule. I understand that Kevin updated his question to stipulate that he wants to use KVM, mostly. But I want to point out that Hyper-V doesn't do gang scheduling. It relies on paravirtualization of the guest OS to avoid the need for gang scheduling. – Jake Oshins Feb 28 '12 at 18:27
  • I didn't know that about Hyper-V, but this does apply to the other major hypervisors. – ewwhite Feb 28 '12 at 19:01
  • 1
    KVM doesn't gang schedule. In fact, only VMWare does this, and even they have added some mechanisms to relax the gang scheduling insanity in v5 – dyasny Jul 14 '13 at 19:23
4

It really depends. If, like you're saying, you're going to "max out", which I suppose means overallocate CPU (assign more virtual CPU cores than you have available, or exactly as many as you have available), then HT should definitely be on.

If you are not overallocating, then it is usually better to test under your specific loads - sometimes HT can actually hurt performance.

dyasny
  • 18,482
  • 6
  • 48
  • 63
  • I do plan to allocate exactly as many cores/threads as are available, but I do not plan to over-allocate. – Soviero Feb 26 '12 at 19:13
  • Do you think the host OS needs no CPU time at all? And if you allocate as many v-cores as you have threads with HT on, you're actually overallocating by at least 70-80%, because even when HT does add to performance, it's usually by 20-30% tops, not by 100%, like one could assume from the thread count. – dyasny Feb 26 '12 at 22:02
  • Ok, so no more than 12 "cores" (75% of 16) allocated? – Soviero Feb 27 '12 at 00:24
  • 1
    Guess I wasn't clear enough. You CAN overallocate, and depending on the loads in the VMs, CPU might not become the bottleneck at all. Moreover, you should never assign more CPUs to a VM than it absolutely needs, because the more CPUs the VM has, the harder it is to schedule, so many v-cpus can actually hinder performance. As for the 20% performance gain by hyperthreading - this is not an absolute, the number can be slightly higher, lower, zero or even negative - depending on the VM loads. – dyasny Feb 27 '12 at 06:33
3

There are a lot of variables that affect VM performance. HT is just one of othe variables but it also depends on how the VM are configured.

One of the variables that affect HT depends on the type of Hypervisor being used.

If you are using lightweight virtual machines like VZ, VServer, etc, then it is quite obvious that HT would bring suitable benefits as these VM aren't actually tightly isolated and are more like running multi-threaded software.

If you are using heavyweight virtual machines like KVM, Xen HVM, etc, then it is possible that HT will interfere with things e.g. when a VM is allocated two CPUs but ends up using one HT each on different cores.

So, the best thing to do is still to test your setup to see what suits you.

sybreon
  • 7,357
  • 1
  • 19
  • 19