VMware Cloud Community
julyusmotyus
Contributor
Contributor

Hyperthreading in VM

Good morning,

I am trying to enable hyperthreading in a virtual machine.

I have checked that the Esxi at the bios level has it enabled and it is also enabled at the vsphere level.
But if I check the wmi it always shows

NumberOfCores=1
NumberOfLogicalProcessors=1


NumberOfCores=1
NumberOfLogicalProcessors=1

I think I should put NumberOfLogicalProcessors=2

Could someone help me?

Reply
0 Kudos
12 Replies
scott28tt
VMware Employee
VMware Employee

Why do you want hyperthreading in a VM? You can allocate multiple sockets to a VM, and/or multiple cores per socket to a VM, why would you need hyperthreading too?

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
julyusmotyus
Contributor
Contributor

Hello¡¡ 

 

I would need to have hyperthreading enabled by a SAP HANA recommendation. They say it can increase performance by 15%.

 

Thank you

Reply
0 Kudos
scott28tt
VMware Employee
VMware Employee

Those kinds of recommendations usually relate to the host, not to a VM.

This might help: https://blogs.vmware.com/apps/2018/01/hyper-threading-impact-virtual-sap-sizing-performance-part-1-2...

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
julyusmotyus
Contributor
Contributor

 

I try to simulate scenario 2

  • Deploying a VM with twice the number of vCPUs as cores in a socket and setting the VM level parameter “Numa.PreferHT” to true . All the vCPUs will be scheduled across all the logical CPUs within the socket/NUMA node.


I have configured the virtual machine with 8 vcpus and 4 cores. But it appears two socket, I think it should appear one socket.

julyusmotyus_0-1651577500518.png

In the virtual machine appear
NumberOfCores=1
NumberOfLogicalProcessors=1

I belive that NumberOfLogicalProcessor should be 2.

 

Thank you.

 

Reply
0 Kudos
bluefirestorm
Champion
Champion

8vCPUs over 2 virtual sockets = 4 logical processors per socket.

This is an example output of a Windows 11 VM with 2 virtual sockets and 4 vCPUs.

C:\Users\User>wmic cpu get numberofcores, numberoflogicalprocessors
NumberOfCores NumberOfLogicalProcessors
2 2
2 2

So your output for wmic cpu get numberofcores, numberoflogicalprocessors should be two lines of 4, 4 (since there are two virtual sockets).

You should check if the boot options is limiting the number of processors. For example on Windows 10/11 on msconfig the Boot tab has an "Advanced Options" button that can limit the "Number of processors". My guess is that your VM is limited to 1 that is why you are seeing only NumberOfCores=1 and NumberOfProcessors=1

Reply
0 Kudos
julyusmotyus
Contributor
Contributor

Hi,

This is correct,  the following appears

julyusmotyus_0-1651587477021.png

But I need that hyperthreading is active, I believe that the correct should be NumberofCores 4 and NumberOfLogicalProcessors 8

If I run the test on my personal computer, the following is displayed

julyusmotyus_1-1651587650067.png

I am sorry because maybe I am confused and in a virtual machine it should not appear in the same way.

Thank you.

Tags (1)
Reply
0 Kudos
virtsysadmin
Enthusiast
Enthusiast

Hyperthreading is not set per VM but for the entire host ,is HT enabled on the host level ? 

https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-3362A2E9-AB03-4C10...

 



I am a VMware employee, But I contribute to VMTN voluntarily (ie. not in any official capacity)
VCIX-DCV 2020|CKA|VCP|VCP vSphere 7|MCTS|RHCA|CCNA|ITIL| Master Specialist - VMware Cloud on AWS 2021
Please hit resolved, when your question has been answered.
Reply
0 Kudos
julyusmotyus
Contributor
Contributor

Hi,

Hyperthreading is correct in the esxi

julyusmotyus_0-1651591350710.png

 

I could create a virtual machine with 32 vcpus 

julyusmotyus_1-1651591420769.png

 

But SAP HANA requeriment is in the operating system the Thread(s) per core =2

In this moment 

julyusmotyus_2-1651591519989.png

Is the same Thread(s) per core that hyperthreading?

Thank you

Reply
0 Kudos
virtsysadmin
Enthusiast
Enthusiast

since you have already enabled HT it's used by the VM and check with SAP HANA about this requirement "But SAP HANA requeriment is in the operating system the Thread(s) per core =2" is it same for a VM which make no sense. 

below only requirement is to enable HT  - https://wiki.scn.sap.com/wiki/display/VIRTUALIZATION/SAP+HANA+on+VMware+vSphere

SAP HANA on vSphere Best Practices

In a nutshell: SAP HANA follows general published vSphere Best Practices for databases:

  • Set Memory Reservations for SAP HANA Virtual Machines
  • Configuring Paravirtual SCSI Controllers and Network Adapters
  • Right sizing of SAP HANA VMs to ensure local NUMA node memory access and high 2nd level cache hit ratios
  • Enable Hyper Threading on the ESXi host
  • Use dedicated networks for vMotion, management, client and if needed backup and replication network
  • Use vMotion and VMware snapshots during non peak times
  • Configure for SAP HANA latency critical the ESXi scheduler optimisation parameters as documented in below best practices guide
  • Ensure you set following SAP HANA / vSphere specific Linux kernel parameters:
    • transparent_hugepage=never
    • numa_balancing=disabled
    • elevator=noop (for RHEL and SLES 12) 
      • if blk-mq I/O path gets used (e.g. SLES 15) then use elevator=none. For further information ask your OS vendor*.
    • vmw_pvscsi.cmd_per_lun=254
    • vmw_pvscsi.ring_pages=32

 



I am a VMware employee, But I contribute to VMTN voluntarily (ie. not in any official capacity)
VCIX-DCV 2020|CKA|VCP|VCP vSphere 7|MCTS|RHCA|CCNA|ITIL| Master Specialist - VMware Cloud on AWS 2021
Please hit resolved, when your question has been answered.
Reply
0 Kudos
julyusmotyus
Contributor
Contributor

Hi,

As you indicate the vm is already using hyperthreading, but if they type in the os "lscpu" the number of thread is 1

If possible that VM guest OS show "Thread(s) per core =2" or this is imposible and it only show in the hypervisor

I should try to demostrate that hyperthreading is activate and the vm guest os and its benefits are being utilized.

Thank you.

Reply
0 Kudos
julyusmotyus
Contributor
Contributor

Hi,

I have seen that in other systems this is possible through multithreading.

https://ec2-immersionday.workshop.aws/specifying-a-custom-number-of-vcpus.html

Is this possible with vSphere?

Thank you

Reply
0 Kudos
bluefirestorm
Champion
Champion

I don't think you simulated the Scenario 2 properly from the 2018 whitepaper properly.


On your subsequent screenshot, it shows the host CPU as 2 sockets x Xeon Gold 5217 (8c/16t) CPU. To simulate Scenario 2, your VM needs to have 16 vCPUs (twice the number of cores of the in one CPU socket), but you only allocated 8 vCPUs.

As for seeing HT from within the OS, I don't think that is possible with VMware. What matters is how the vCPUs are scheduled into the physical core/HT. I think the purpose of the SAP/HANA using HT is to have access to same L1/L2 cache as 2 HTs in the the same CPU core share the same L1/L2 cache. All cores share the same L3 cache.

Use this as reference as it states clearly it is for 6.5 and later. The previous whitepaper is from 2018, don't know how relevant it is anymore.
https://core.vmware.com/resource/sap-hana-hyperconverged-infrastructure-hci-solutions-powered-vmware...

Even though you configured as two virtual sockets, normally ESXi would try to schedule all vCPUs in the same socket (for RAM locality reasons).

Anyway, have a good read/understanding first rather than trying settings left, right, and centre.

Reply
0 Kudos