Hyper-V e Hyper-threading

L’Hyper-Threading è una tecnologia introdotta da Intel che consente l’esecuzione di più thread in ogni core. In sostanza dal punto di vista del sistema operativo, un processore single core dotato di tecnologia Hyper-Threading viene visto come un processore dual core.

La tecnologia nata nel 2003 e attiva fino al 2006 quando hanno fatto la comparsa i processori basati sull’architettura Core, nel 2008 con i processori Nehalem viene introdotta la tecnologia Simultaneous Multi-Threading che è l’evoluzione l’Hyper-Treading.

Alla domanda se abilitare o meno l’Hyper-Treading su computer in cui è installato il ruolo Hyper-V è possibile fare riferimento al post HYPER-V 2008 R2 SP1 Best Practices (In Easy Checklist Form) dove viene correttamente indicato di non abilitarlo su computer con 32 core o più in quanto al sistema operativo verrebbero resi disponibili un numero di processori logici superiori a quanto Hyper-V nella versione WS2008 R2 riesce a gestire ovvero 64:

“If server has more than 32 physical cores, do not enable Hyper Threading, as it creates more logical cores than Hyper-V supports on Server 2008 R2. (Max is 64.)”

In Windows Server 2012 il numero di processori logici supportati è 320 (si veda Hyper-V Scalability in Windows Server 2012) quindi la considerazione precedente andrebbe applicata a computer con un numero di core fisici maggiore o uguale 160.

Per quanto riguarda poi la gestione dei processori logici in Hyper-V si veda la considerazione del PM di Hyper-V riportata nel seguente Hyper-V Concepts – vCPU (Virtual Processor):

“In the case of hypervisors a Logical processor does equal a vCPU.  However, a logical processor does not equal a core, nor does Task Manager show you the number of Logical Processors that you have.  I have stopped using the term “logical processor” when I talk of hypervisors.  It is a very technical term that means something to software developers and something totally different to systems administrators.

Ben (the Hyper-V PM) describes it this way:

This is a single execution pipeline on the physical processor.  In the “good old days” someone could tell you that they had a two processor system – and you knew exactly what they had.  Today if someone told you that they had a two processor system you do not know how many cores each processor has, or if hyper threading is present.  A two processor computer with hyper threading would actually have 4 execution pipelines – or 4 logical processors.  A two processor computer with quad-core processors would in turn have 8 logical processors.
A virtual processor is a single logical processor that is exposed to a partition by the hypervisorVirtual processors can be mapped to any of the available logical processors in the physical computer and are scheduled by the hypervisor to allow you to have more virtual processors than you have logical processors.”

Dal seguente Hyper-V VM Density, VP:LP Ratio, Cores and Threads… vengono date raccomandazioni date la raccomandazioni da rispettare per l’assegnazione processore logico – processore Virtuale. Nonostante con W7 in VDI si possa arrivare a 12 processori virtuali per processore logico con Hyper-Treading attivato in generale io preferisco non superare nell’assegnazione dei processori virtuali sulle VM il numero dei processori logici.

Concludendo sul fatto se convenga o meno abilitare l’Hyper-Treading su sistemi Hyper-V dal momento che lo stesso PM di Hyper-V ammette che non sempre porta dei benifici (si vedano i commenti del post Hyper-V CPU Scheduling–Part 1) con cordo con quanto riportato nel documento di HP Best Practices When Deploying Microsoft Windows Server on the HP ProLiant DL980, ovvero di testare il sistema sia con l’Hyper-Treading abilitato che disabilitato per capire in base al proprio scenario se conviene o meno tenerlo abilitato:

In general, the following hyper-threading settings are recommended for optimal performance:
Enabled – for systems running Windows Server 2008 R2, Windows Server 2008 R2 SP1, or Windows Server 2012, if the application supports more than 64 processors, and if the application benefits from the additional logical processors
Disabled – for systems running Windows 2008 SP2 or Windows Server 2008 R2 Hyper-V, when there are more than 64 logical processors

Performance testing may indicate a zero performance gain when enabling hyper-threading, and in some cases, even degraded performance. HP always recommends that you test your workloads with hyper-threading both ON and OFF. Whether or not the workload or custom application supports more than 64 processors, it is always good practice to test and benchmark these configurations. Software licensing may dictate that hyper-threading and/or some cores are disabled. Also, you can ignore the hyper-threading alert and Degraded State notice if the server workload does not benefit from hyper-threading.

Si noti però che se si desidera utilizzare la tecnologia RemoteFX occorre abilitare l’Hyper-Treading , a riguardo si vedano:

Deploying Microsoft RemoteFX on a Single Remote Desktop Virtualization Host Server Step-by-Step Guide (che pone fra i prerequisiti “Ensure that the hyper-threading technology is enabled in the BIOS of the RD Virtualization Host server”) e Configuring USB Device Redirection with Microsoft RemoteFX Step-by-Step Guide (che da la stessa indicazione tra i prerequisiti).

Si veda anche Implementing RemoteFX on HP ProLiant Servers che riporta:

“RemoteFX features require both Hyper-V and Hyper-threading enabled at the BIOS. For information on enabling Hyper-V and Hyper-threading, refer our integration note, “Implementing Microsoft® Windows Server® 2008 R2 Hyper-V™ and Microsoft Hyper-V Server 2008 R2 on HP ProLiant servers”.”

Il documento Implementing Microsoft® Windows Server® 2008 R2 Hyper-V™ and Microsoft Hyper-V Server 2008 R2 on HP ProLiant servers indica la procedura per l’abilitazione del supporto ad Hyper-V e in linea generale suggerisce la disabilitazione della tecnologia Hyper-Treading:

ProLiant servers with Intel Processors
To enable support for hardware-assisted virtualization in the RBSU, complete the following steps:
1. Restart or power-on the server.
2. Access the RBSU by pressing F9 when prompted.
3. From the RBSU Menu, select Advanced Options
4. From the Advanced Options menu, select Processor Options.
5. If the server supports Hyper-Threading, select Processor Hyper-Threading, press Enter, and then select Disabled.
6. Select No-Execute Memory Protection, press Enter, and then select Enabled.
7. Select Intel(R) Virtualization Technology, press Enter, and then select Enabled.
8. Press the Esc key until you receive a prompt to press F10 to confirm exiting the RBSU. The server will restart.

Conclusioni

  1. L’Hyper-Treading va disabilitato se il numero di processori logici che renderebbe disponibili al sistema operativo (pari al doppio dei core fisici) supere il nuomero dei processori logici gestibili da Hyper-V (64 per WS2008R2 e 320 per WS2012)
  2. In caso contrario l’Hyper-Treading deve essere abilitato se è necessario implementare un RD Virtualization Host che deve utilizzare la tecnologia RemoteFX
  3. In alternativa se il sistema di virtualizzazione deve eseguire VM dedicate al VDI anche senza l’utilizzo della tecnologia RemoteFX è probabile che tragga vantaggi dall’utilizzo dell’Hyper-Treading in quanto come riportato in Hyper-V VM Density, VP:LP Ratio, Cores and Threads…
  4. In tutti gli altri casi occorre testare il sistema con l’Hyper-Treading abilitato e disabilitato per stabilire quale configurazione è più performante.