VMware Cloud Community
orhuidobro
Contributor
Contributor
Jump to solution

Hyper-threading and vCPUs

Some years ago I was working with VMware Server 1.0 on Windows 2003. I had 2 servers with VMware Server, one of them has one Hyper-threaded Intel CPU, and the other one has the same Intel CPU but with HT disabled.

I had a Virtual Machine running a 16 bit application, which took all the available CPU cycles. When this VM ran on the non-HT server, the Windows host reported 100% CPU usage. When the VM ran on the HT-enabled server, host CPU usage was 50%, and task manager showed the VM taking all the cycles from a half-processor and the other half-processor almost idle.

Assuming that CPUs were equal, my understanding is that the VM got more CPU power running on the non-HT server than running on the HT-enabled server (because HT divided by 2 the CPU, and assigned just a half CPU to the VM).

My question is, what happens with HT on ESX?

When I assign a vCPU to a VM, it will use just a half core in a Hyper-threaded server, but a full core on a HT-disabled server? (assuming no other VMs competing for resources).

Thanks and best regards.

0 Kudos
1 Solution

Accepted Solutions
weinstein5
Immortal
Immortal
Jump to solution

With the following thoughts on 2 and 3 -

2) But also remember the hypervisor (vmkernel) is scheduling those vcpus to the LCPU it will make sure that the vCPU is scheduled to LCPU that has the most available CPU cycles - If you are in situation where all LCPUs are heavily loaded then you need to increase the resource capacity by adding additional host to the cluster (if you ave one)

3) The VM does not have direct access to the LCPU but it is scheduled there by the vmkernel - so if the VM is idle it can theoretically being use no (or at least very few cpu cycles)

hope this helps -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

View solution in original post

0 Kudos
7 Replies
weinstein5
Immortal
Immortal
Jump to solution

Welcome to the Community - ESX does a much better job of scheduling virtual CPUs than VMware Server and to correct it is not 50% reduction in processing power for an HT core - in reality it is more like 5% reduction in processing power -

Best pracice is always to have Hyperthreading enabled - the reason for this is because it is more important to provide the ESX more logical CPUs to schedule vCPUs to -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
DSTAVERT
Immortal
Immortal
Jump to solution

ESX(i) does take advantage of Hyperthreading. The additional logical threads can be used to provide additional resources to the VMs but should not be compared to a full core. Much of their usefulness will be dependent on the process running on the VMs.

http://pubs.vmware.com/vsp40_i/wwhelp/wwhimpl/js/html/wwhelp.htm#href=resmgmt/c_hyperthreading.html Have a look at the ESX/ESXi link.

-- David -- VMware Communities Moderator
orhuidobro
Contributor
Contributor
Jump to solution

Hello Weinstein.

AFAIK Hyper-threading (at least early versions) divided 1 CPU in 2 logical CPUs. That was accomplished giving half of CPU cycles to each logical CPU.

As a result, a Windows host sees 2 CPUs, each one having about 50% of total CPU power. In that case, a VM running inside VMware Server receives a different amount of power, depending on if the CPU is HTed or not (in HTed case, the CPU is half of powerful).

I don’t really understand how ESX handles Hyper-threading, I’m assuming that ESX on a server HT-enabled will see twice CPU cores, with half power each. I that case a vCPU running on a HT-enabled host will receive half of CPU cycles than one on a HT-disabled host.

Is my assumption wrong?

(Apologies for my frequent references to Windows, but there is where I come from).

Thanks and best regards.

0 Kudos
weinstein5
Immortal
Immortal
Jump to solution

Not really - HT was not splitting the cpu into two - Intel realized the their processor were sitting idle more than 50% of the time and developed a 'scheduler' that allowed the instructins of a second thread to be schedule while the first thread is idle waiting for a component (e.g. a disk read/wirte - the scheduling technology has gotten much better over time but now is being over shadowed by a higher density of cores on a physical cpu

ESX handles HT by using like a core and treats it as a Logical CPU (LCPU) and it is to this LCPU that the ESX hypervisor will schedule the vCPUs to a LCPU - you are correct a dual quad core without HT will see 8 LCPUs while a dual quad core WITH HT will see 16 LCPUs - and as I indicated above the virtual macine will get large persentage of a core when it needs it -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
orhuidobro
Contributor
Contributor
Jump to solution

Thank you Weinstein, now I’m getting a better understanding of this matter.

So, let me check if I understand right:

  1. In a host HT-enabled with little load, a vCPU will have almost a full core available.
  2. In a host HT-enabled highly loaded, a vCPU will have about a half core power (because HT is giving many cycles to another thread).
  3. From a VM perspective, an HT-disabled core will ensure more CPU power available for the vCPU, than an HT-enabled core.
  4. From a host perspective, HT provides a better use of CPU cycles (less idle cycles).

Thanks and best regards.

0 Kudos
weinstein5
Immortal
Immortal
Jump to solution

With the following thoughts on 2 and 3 -

2) But also remember the hypervisor (vmkernel) is scheduling those vcpus to the LCPU it will make sure that the vCPU is scheduled to LCPU that has the most available CPU cycles - If you are in situation where all LCPUs are heavily loaded then you need to increase the resource capacity by adding additional host to the cluster (if you ave one)

3) The VM does not have direct access to the LCPU but it is scheduled there by the vmkernel - so if the VM is idle it can theoretically being use no (or at least very few cpu cycles)

hope this helps -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
ChrisDearden
Expert
Expert
Jump to solution

I'm sure there are benchmarks showing something like a 20% gain in performance with Hyperthreading in the nehalem series CPU's

I'd start with enabled and see if it meets your needs.

If this post has been useful , please consider awarding points. @chrisdearden http://jfvi.co.uk http://vsoup.net
0 Kudos