VMware vSphere

 View Only
Expand all | Collapse all

Hyperthreading in VM

  • 1.  Hyperthreading in VM

    Posted May 03, 2022 08:24 AM

    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?



  • 2.  RE: Hyperthreading in VM

    Posted May 03, 2022 08:30 AM

    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?

     



  • 3.  RE: Hyperthreading in VM

    Posted May 03, 2022 08:34 AM

    Hello¡¡ 

     

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

     

    Thank you



  • 4.  RE: Hyperthreading in VM

    Posted May 03, 2022 08:43 AM

    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.html

     



  • 5.  RE: Hyperthreading in VM

    Posted May 03, 2022 11:36 AM

     

    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.

     



  • 6.  RE: Hyperthreading in VM

    Posted May 03, 2022 01:31 PM

    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



  • 7.  RE: Hyperthreading in VM

    Posted May 03, 2022 02:22 PM

    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.



  • 8.  RE: Hyperthreading in VM

    Posted May 03, 2022 02:36 PM

    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-B9A1-3E6CA78D399B.html

     



  • 9.  RE: Hyperthreading in VM

    Posted May 03, 2022 03:27 PM

    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



  • 10.  RE: Hyperthreading in VM

    Posted May 03, 2022 04:04 PM

    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

     



  • 11.  RE: Hyperthreading in VM

    Posted May 03, 2022 05:58 PM

    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.



  • 12.  RE: Hyperthreading in VM

    Posted May 04, 2022 08:01 AM

    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



  • 13.  RE: Hyperthreading in VM

    Posted May 04, 2022 11:06 AM

    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-vsan#appendix

    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.