TEE14 Scripted Demo 1 – Guest-Aware NUMA

As promised at Teched Europe 2014, I am sharing each of the PowerShell scripts that I used to drive my feature demos in my session. The first of these scripts focuses on non-uniform memory access, or NUMA.

image

All of my demo scripts work in this kind of fashion:

  1. Clean up the lab
  2. Create demo environment variables for hosts, clusters, machines
  3. Write-Host “some cmdlet and parameters”
  4. Do the cmdlet and some parameters
  5. Optionally display the results
  6. Do more stuff
  7. Clean up the lab.

Most of the code in these scripts is fluff, purely for display and lab prep/reset.

In this script I:

  1. Clean up the lab, ensure the VM (spans NUMA nodes cos of vCPU count) is just the way I want it.
  2. Get the NUMA config of the host.
  3. Get the NUMA config of the VM.
  4. Show that the VM is not NUMA aligned.
  5. Retrieve the VM’s advanced NUMA configuration.
  6. Shutdown the VM, set it to use static memory, and restart it.
  7. Query the VMs NUMA alignment, and see that it is aligned now, but we have use static memory.
  8. Reset the lab back to the start.

CLS
$DemoVM1="NUMA"

#Reset the demo
Stop-VM $DemoVM1 -Force | Out-Null
Set-VMMemory $DemoVM1 -DynamicMemoryEnabled:$true -StartupBytes 512MB -MaximumBytes 8GB -MinimumBytes 256MB
Start-VM $DemoVM1 | Out-Null

#Start the demo
Read-Host "Start the demo"
Write-Host "`nGet-VMHostNumaNode"
Get-VMHostNumaNode
Write-Host "`nThe host has 2 NUMA nodes. Large VMs should also have 2 NUMA nodes for best performance" -foregroundcolor red -backgroundcolor yellow

Read-Host "`nCheck the NUMA and Dynamic Memory configuration of the VM $DemoVM1"
Write-Host "`nGet-VM $DemoVM1 | Select Name, ProcessorCount, MemoryMaximum, DynamicMemoryEnabled, NumaAligned, NumaNodesCount, NumaSocketCount"
Get-VM $DemoVM1 | Select Name, ProcessorCount, MemoryMaximum, DynamicMemoryEnabled, NumaAligned, NumaNodesCount, NumaSocketCount | Out-Host
Write-Host "`nGuest NUMA isn’t alligned and the 24 vCPU virtual machine has only 1 NUMA node" -foregroundcolor red -backgroundcolor yellow

Read-Host "`nGet the advanced NUMA configuration of the VM $DemoVM1"
Write-Host "`nGet-VMProcessor $DemoVM1 | Select Count, MaximumCountPerNumaNode, MaximumCountPerNumaSocket`n"
Get-VMProcessor $DemoVM1 | Select Count, MaximumCountPerNumaNode, MaximumCountPerNumaSocket
Write-Host "`nGet-VMMemory $DemoVM1 | Select MaximumPerNumaNode`n"
Get-VMMemory $DemoVM1 | Select MaximumPerNumaNode
Write-Host "`nThis is the NUMA node configuration that Hyper-V can present to the VM via Guest-Aware NUMA" -foregroundcolor red -backgroundcolor yellow

Read-Host "`nDisable Dynamic Memory for the VM $DemoVM1 & restart it"
Stop-VM $DemoVM1 -Force
Write-Host "`nSet-VMMemory $DemoVM1 -DynamicMemoryEnabled:$false -StartupBytes 8GB"
Set-VMMemory $DemoVM1 -DynamicMemoryEnabled:$false -StartupBytes 8GB
Start-VM $DemoVM1
Write-Host "`nGet-VM $DemoVM1 | Select Name, ProcessorCount, MemoryMaximum, DynamicMemoryEnabled, NumaAligned, NumaNodesCount, NumaSocketCount`n"
Get-VM $DemoVM1 | Select Name, ProcessorCount, MemoryMaximum, DynamicMemoryEnabled, NumaAligned, NumaNodesCount, NumaSocketCount | Out-Host
Write-Host "`nThe VM now is NUMA aligned and has a NUMA configuration that matches the host hardware" -foregroundcolor red -backgroundcolor yellow

#End the demo
Read-Host "`nEnd the demo"
Stop-VM $DemoVM1 -Force
Set-VMMemory $DemoVM1 -DynamicMemoryEnabled:$true -StartupBytes 512MB -MaximumBytes 8GB -MinimumBytes 256MB
Start-VM $DemoVM1 | Out-Null

5 thoughts on “TEE14 Scripted Demo 1 – Guest-Aware NUMA”

  1. I’m watching your presentation on this and I’ve watched this part many times. I’m not seeing why you needed to turn off dynamic memory to get Numa aligned. Can you explain that?

  2. Fair enough, but how did you get to that conclusion? Will dynamic memory always mess up NUMA? I can accept it if that’s just the way it is, but I had never heard that so I assume there must have been some thought process that helped you arrive at that conclusion in your case.

    1. I did not come to that conclusion – I was told this by the Hyper-V program managers. And it’s easy to observe by trying it.

  3. Ok this TechNet article explains it and answers some of my questions:

    http://technet.microsoft.com/en-us/library/dn282282.aspx#BKMK_NUMA_DM

    So we know NUMA alignment is of importance only when the workload is NUMA aware (SQL and web servers for example). But how much of a performance hit do you take by not being NUMA aligned? I think the answer is it depends on a few factors. Hardware being one factor and the other factor being how demanding your workload is. If it’s really beefy hardware running very demanding workloads then I imagine the benefit is much more than running smaller workloads on cheaper hardware.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.