{"id":25,"date":"2013-03-16T21:34:26","date_gmt":"2013-03-16T21:34:26","guid":{"rendered":"http:\/\/www.markwasem.com\/?p=25"},"modified":"2013-05-06T21:57:46","modified_gmt":"2013-05-06T21:57:46","slug":"hyper-v-numa-nodes","status":"publish","type":"post","link":"http:\/\/www.markwasem.com\/?p=25","title":{"rendered":"Hyper-V + NUMA Nodes"},"content":{"rendered":"<p>While I had come across the information before, until recently I did not find the time to put the necessary research in to what&#8217;s involved in properly configuring Hyper-V with NUMA nodes to take advantage of today&#8217;s multi-processor multi-core servers.<\/p>\n<p>In simple terms, disabling NUMA node spanning in the Hyper-V hypervisor will prevent the system from &#8220;reaching&#8221; for RAM that is, by circuitry, further away and thus slower. If more detail is what you want, please check out the links below that I found very informative.<\/p>\n<ul>\n<li><a href=\"http:\/\/www.benjaminathawes.com\/blog\/Lists\/Posts\/Post.aspx?ID=28\" target=\"_blank\">http:\/\/www.benjaminathawes.com\/blog\/Lists\/Posts\/Post.aspx?ID=28<\/a><\/li>\n<li><a href=\"http:\/\/frankdenneman.nl\/2010\/02\/03\/sizing-vms-and-numa-nodes\/\" target=\"_blank\">http:\/\/frankdenneman.nl\/2010\/02\/03\/sizing-vms-and-numa-nodes\/<\/a><\/li>\n<li><a href=\"http:\/\/www.techrepublic.com\/blog\/five-apps\/five-tips-for-optimizing-hyper-v\/726\" target=\"_blank\">http:\/\/www.techrepublic.com\/blog\/five-apps\/five-tips-for-optimizing-hyper-v\/726<\/a><\/li>\n<li><a href=\"http:\/\/www.aidanfinn.com\/?p=11945\" target=\"_blank\">http:\/\/www.aidanfinn.com\/?p=11945<\/a><\/li>\n<\/ul>\n<p>In my opinion a large part of NUMA node optimization is derived from manually assigning NUMA nodes based on memory need. This manual assignment can be done by creating a PowerShell script. Copy\/paste the below text in to Notepad and save it as numa.ps1 (or whatever you would like with .ps1 extension.)<\/p>\n<blockquote>\n<pre>################################################\r\n# Developer: Anthony F. Voellm\r\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Taylor Brown\r\n# Copyright (c) 2008 by Microsoft Corporation\r\n# All rights reserved\r\n#\r\n# This is \"demonstration\" code and there are no\r\n# warrantees expressed or implied\r\n################################################\r\n\r\n# This script will set the Virtual Machine to run\r\n# on a specific NUMA node\r\n\r\n# Check command line arguments\r\n\r\nif (($args.length -lt 1) -or\r\n\u00a0\u00a0\u00a0 (($args[0] -ne \"\/list\") -and\r\n\u00a0\u00a0\u00a0\u00a0 ($args[0] -ne \"\/set\") -and\r\n\u00a0\u00a0\u00a0\u00a0 ($args[0] -ne \"\/clear\")) -or\r\n\u00a0\u00a0\u00a0\u00a0 (($args[0] -eq \"\/set\") -and ($args.length -lt 3)) -or\r\n\u00a0\u00a0\u00a0\u00a0 (($args[0] -eq \"\/clear\") -and ($args.length -lt 2))) {\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"numa.ps1 \/list [&lt;Hyper-V host&gt;]\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"numa.ps1 \/set &lt;vm machine name&gt; &lt;required node&gt; [&lt;Hyper-V host&gt;]\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"numa.ps1 \/clear &lt;vm machine name&gt; [&lt;Hyper-V host&gt;]`n\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"Options:\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"`t\/list - show configured VM's\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"`t\/set &lt;vm machine name&gt; &lt;required node&gt; - set the NUMA node for the VM\"\r\n\u00a0\u00a0\u00a0\u00a0 Write-Host \"`t\/clear &lt;vm machine name&gt; - clear NUMA node seting for the VM\"\r\n\u00a0\u00a0\u00a0\u00a0 exit;\r\n\u00a0 }\r\n\r\n# just display VM's\r\nif ($args[0] -eq \"\/list\") {\r\n\u00a0 if ($args.length -gt 1) {\r\n\u00a0\u00a0\u00a0 $HyperVHost = $args[1];\r\n\u00a0 }\r\n\u00a0 Get-WmiObject -Namespace 'root\\virtualization' -Query \"Select * From Msvm_ComputerSystem\" | select ElementName\r\n\u00a0 exit;\r\n}\r\n\r\n# Set or clear\r\n\r\n$HyperVHost = '.';\r\nif ($args[0] -eq \"\/set\") {\r\n\u00a0 if ($args.length -gt 3) {\r\n\u00a0\u00a0\u00a0 $HyperVHost = $args[3];\r\n\u00a0 }\r\n\u00a0 $VMName = $args[1];\r\n\u00a0 $RequiredNode = $args[2];\r\n} elseif ($args[0] -eq \"\/clear\") {\r\n\u00a0 if ($args.length -gt 2) {\r\n\u00a0\u00a0\u00a0 $HyperVHost = $args[2];\r\n\u00a0 }\r\n\u00a0 $VMName = $args[1];\r\n}\r\n\r\n#Main Script Body\r\n$VMManagementService = Get-WmiObject -Namespace root\\virtualization -Class Msvm_VirtualSystemManagementService -ComputerName $HyperVHost\r\n\r\n$Query = \"Select * From Msvm_ComputerSystem Where ElementName='\" + $VMName + \"'\"\r\n\r\n$SourceVm = Get-WmiObject -Namespace root\\virtualization -Query $Query -ComputerName $HyperVHost\r\n\r\n$VMSettingData = Get-WmiObject -Namespace root\\virtualization -Query \"Associators of {$SourceVm} Where ResultClass=Msvm_VirtualSystemSettingData AssocClass=Msvm_SettingsDefineState\" -ComputerName $HyperVHost\r\n\r\nif ($args[0] -eq \"\/set\") {\r\n\u00a0 $VMSettingData.NumaNodesAreRequired = 1\r\n\u00a0 $VMSettingData.NumaNodeList = @($RequiredNode)\r\n} else {\r\n\u00a0 $VMSettingData.NumaNodesAreRequired = 0\r\n}\r\n\r\n$VMManagementService.ModifyVirtualSystem($SourceVm, $VMSettingData.PSBase.GetText(1))<\/pre>\n<\/blockquote>\n<p>I found the above PowerShell scripting when I was reading through <a href=\"http:\/\/blogs.msdn.com\/b\/tvoellm\/archive\/2008\/09\/28\/looking-for-that-last-once-of-performance_3f00_-then-try-affinitizing-your-vm-to-a-numa-node-.aspx\" target=\"_blank\">this article on the MSDN blog<\/a>. If you&#8217;re running through the steps here,\u00a0 the next hurdle you&#8217;ll run in to is the script permissions on Windows 2008. See the below TechNet article for correcting the &#8220;File XXX cannot be loaded because the execution of scripts is disabled on this system.&#8221; error.<br \/>\nModifying PowerShell script permissions: <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/ee176949.aspx\" target=\"_blank\">http:\/\/technet.microsoft.com\/en-us\/library\/ee176949.aspx<\/a><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>While I had come across the information before, until recently I did not find the time to put the necessary research in to what&#8217;s involved in properly configuring Hyper-V with NUMA nodes to take advantage of today&#8217;s multi-processor multi-core servers. &hellip; <a href=\"http:\/\/www.markwasem.com\/?p=25\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9,12,11,10],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-technology","tag-hyper-v","tag-numa-nodes","tag-server-2008-r2","tag-virtualization"],"_links":{"self":[{"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":3,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":27,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/27"}],"wp:attachment":[{"href":"http:\/\/www.markwasem.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.markwasem.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}