{"id":943,"date":"2015-02-25T12:30:52","date_gmt":"2015-02-25T20:30:52","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/glenn\/?p=943"},"modified":"2018-11-13T10:52:26","modified_gmt":"2018-11-13T18:52:26","slug":"balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/","title":{"rendered":"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes"},"content":{"rendered":"<p>One issue I recently ran into with a customer was a case where they were using a new, two-socket server with two <a href=\"https:\/\/ark.intel.com\/products\/75283\/Intel-Xeon-Processor-E5-2697-v2-30M-Cache-2_70-GHz\">Intel Xeon E5-2697 v2<\/a> Ivy Bridge-EP processors. This particular 22nm processor has twelve physical cores, plus hyper-threading, so you can have 24 logical cores for one entire physical processor, and 48 logical cores for a two-socket server with both sockets populated.<\/p>\n<p>The reason why we had an issue is because both <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/sql-server\/compute-capacity-limits-by-edition-of-sql-server\">SQL Server 2012 and 2014 Standard Edition have an artificial license limit of either 16 physical cores or 32 logical cores<\/a> (along with a limit of four sockets, whichever is lower). This meant that SQL Server 2014 Standard Edition could only use 32 out of the 48 logical cores in this new server. To make matters worse, the available cores were spread unevenly across the two NUMA nodes in the server. There were 24 logical cores on one NUMA node and 8 logical cores on the other NUMA node in the server, which was not an ideal situation.<\/p>\n<p>Fortunately, it is pretty easy to fix this issue by using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/statements\/alter-server-configuration-transact-sql\">ALTER SERVER CONFIGURATION<\/a> command that was introduced in SQL Server 2008 R2. On the negative side, fixing it was not completely intuitive, because of these <a href=\"https:\/\/sqlperformance.com\/2013\/08\/sql-memory\/common-sense-licensing-changes-for-sql-server-2014-standard-edition\">dumb Standard Edition license limits<\/a>.<\/p>\n<p>You can use the queries in the code below to detect and correct this issue.<\/p>\n<pre class=\"csharpcode\"><span class=\"rem\">-- Balancing your available SQL Server core licenses evenly across two NUMA nodes<\/span>\n<span class=\"rem\">-- Glenn Berry<\/span>\n<span class=\"rem\">-- SQLskills.com<\/span>\n\n\n<span class=\"rem\">-- Get socket, physical core and logical core count from SQL Server Error Log<\/span>\n<span class=\"kwrd\">EXEC<\/span> sys.xp_readerrorlog 0, 1, N<span class=\"str\">'detected'<\/span>, N<span class=\"str\">'socket'<\/span>;\n\n\n<span class=\"rem\">-- SQL Server NUMA node information <\/span>\n<span class=\"kwrd\">SELECT<\/span> node_id, node_state_desc, memory_node_id, processor_group, online_scheduler_count, \n       active_worker_count, avg_load_balance, resource_monitor_state\n<span class=\"kwrd\">FROM<\/span> sys.dm_os_nodes <span class=\"kwrd\">WITH<\/span> (NOLOCK) \n<span class=\"kwrd\">WHERE<\/span> node_state_desc &lt;&gt; N<span class=\"str\">'ONLINE DAC'<\/span> <span class=\"kwrd\">OPTION<\/span> (RECOMPILE);\n\n\n<span class=\"rem\">-- SQL Server schedulers by NUMA node<\/span>\n<span class=\"kwrd\">SELECT<\/span> parent_node_id, \n  <span class=\"kwrd\">SUM<\/span>(current_tasks_count) <span class=\"kwrd\">AS<\/span> [current_tasks_count], \n  <span class=\"kwrd\">SUM<\/span>(runnable_tasks_count) <span class=\"kwrd\">AS<\/span> [runnable_tasks_count], \n  <span class=\"kwrd\">SUM<\/span>(active_workers_count) <span class=\"kwrd\">AS<\/span> [active_workers_count], \n  <span class=\"kwrd\">AVG<\/span>(load_factor) <span class=\"kwrd\">AS<\/span> avg_load_factor\n<span class=\"kwrd\">FROM<\/span> sys.dm_os_schedulers <span class=\"kwrd\">WITH<\/span> (NOLOCK) \n<span class=\"kwrd\">WHERE<\/span> [status] = N<span class=\"str\">'VISIBLE ONLINE'<\/span>\n<span class=\"kwrd\">GROUP<\/span> <span class=\"kwrd\">BY<\/span> parent_node_id;\n\n\n\n<span class=\"rem\">-- SQL Server NUMA node and cpu_id information<\/span>\n<span class=\"kwrd\">SELECT<\/span> parent_node_id, scheduler_id, cpu_id\n<span class=\"kwrd\">FROM<\/span> sys.dm_os_schedulers <span class=\"kwrd\">WITH<\/span> (NOLOCK) \n<span class=\"kwrd\">WHERE<\/span> [status] = N<span class=\"str\">'VISIBLE ONLINE'<\/span>;\n\n\n<span class=\"rem\">-- Fixing the problem<\/span>\n\n<span class=\"rem\">-- Unfortunately, this does not work, due to the license limits in SQL 2012\/2014 Standard Edition<\/span>\n<span class=\"kwrd\">ALTER<\/span> SERVER CONFIGURATION <span class=\"kwrd\">SET<\/span> PROCESS AFFINITY NUMANODE = 0,1;\n\n<span class=\"rem\">-- Msg 5833, Level 16, State 2, Line 7<\/span>\n<span class=\"rem\">-- The affinity mask specified is greater than the number of CPUs supported or licensed on this edition of SQL Server.<\/span>\n\n\n<span class=\"rem\">-- This command spreads your available 32 logical core licenses across two NUMA nodes <\/span>\n<span class=\"rem\">-- This is valid for an Intel processor, with HT enabled<\/span>\n<span class=\"kwrd\">ALTER<\/span> SERVER CONFIGURATION\n<span class=\"kwrd\">SET<\/span> PROCESS AFFINITY CPU = 0 <span class=\"kwrd\">TO<\/span> 15, 25 <span class=\"kwrd\">TO<\/span> 40;<\/pre>\n<pre class=\"csharpcode\">&nbsp;<\/pre>\n<style type=\"text\/css\">.csharpcode, .csharpcode pre\n{\n\tfont-size: small;\n\tcolor: black;\n\tfont-family: consolas, \"Courier New\", courier, monospace;\n\tbackground-color: #ffffff;\n\t\/*white-space: pre;*\/\n}\n.csharpcode pre { margin: 0em; }\n.csharpcode .rem { color: #008000; }\n.csharpcode .kwrd { color: #0000ff; }\n.csharpcode .str { color: #006080; }\n.csharpcode .op { color: #0000c0; }\n.csharpcode .preproc { color: #cc6633; }\n.csharpcode .asp { background-color: #ffff00; }\n.csharpcode .html { color: #800000; }\n.csharpcode .attr { color: #ff0000; }\n.csharpcode .alt \n{\n\tbackground-color: #f4f4f4;\n\twidth: 100%;\n\tmargin: 0em;\n}\n.csharpcode .lnum { color: #606060; }\n<\/style>\n<p>&nbsp;<\/p>\n<p>A similar issue with \u201cgrandfathered\u201d SQL Server 2012 Enterprise Server+CAL customers was <a href=\"https:\/\/sqlperformance.com\/2012\/11\/system-configuration\/2012-cal-problems\">discussed by my colleague, Jonathan Kehayias here<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>One issue I recently ran into with a customer was a case where they were using a new, two-socket server with two Intel Xeon E5-2697 v2 Ivy Bridge-EP processors. This particular 22nm processor has twelve physical cores, plus hyper-threading, so you can have 24 logical cores for one entire physical processor, and 48 logical cores [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,20,236,31,156],"tags":[237,238],"class_list":["post-943","post","type-post","status-publish","format-standard","hentry","category-sql-server-hardware","category-intel","category-numa","category-sql-server-2012","category-sql-server-2014","tag-licensing","tag-numa-nodes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry\" \/>\n<meta property=\"og:description\" content=\"One issue I recently ran into with a customer was a case where they were using a new, two-socket server with two Intel Xeon E5-2697 v2 Ivy Bridge-EP processors. This particular 22nm processor has twelve physical cores, plus hyper-threading, so you can have 24 logical cores for one entire physical processor, and 48 logical cores [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/\" \/>\n<meta property=\"og:site_name\" content=\"Glenn Berry\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-25T20:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-13T18:52:26+00:00\" \/>\n<meta name=\"author\" content=\"Glenn Berry\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Glenn Berry\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/\",\"name\":\"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/#website\"},\"datePublished\":\"2015-02-25T20:30:52+00:00\",\"dateModified\":\"2018-11-13T18:52:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/57a8972435106bac7970692fcf5edfa7\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/\",\"name\":\"Glenn Berry\",\"description\":\"Semi-random musings about SQL Server performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/57a8972435106bac7970692fcf5edfa7\",\"name\":\"Glenn Berry\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/64bdac8830f25f2f8cc780f8a1286c66ff1182218009271e7a953639596f7e25?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/64bdac8830f25f2f8cc780f8a1286c66ff1182218009271e7a953639596f7e25?s=96&d=mm&r=g\",\"caption\":\"Glenn Berry\"},\"sameAs\":[\"https:\/\/www.sqlskills.com\/blogs\/glenn\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/glenn\/author\/glenn\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/","og_locale":"en_US","og_type":"article","og_title":"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry","og_description":"One issue I recently ran into with a customer was a case where they were using a new, two-socket server with two Intel Xeon E5-2697 v2 Ivy Bridge-EP processors. This particular 22nm processor has twelve physical cores, plus hyper-threading, so you can have 24 logical cores for one entire physical processor, and 48 logical cores [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/","og_site_name":"Glenn Berry","article_published_time":"2015-02-25T20:30:52+00:00","article_modified_time":"2018-11-13T18:52:26+00:00","author":"Glenn Berry","twitter_misc":{"Written by":"Glenn Berry","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/","url":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/","name":"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes - Glenn Berry","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/#website"},"datePublished":"2015-02-25T20:30:52+00:00","dateModified":"2018-11-13T18:52:26+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/57a8972435106bac7970692fcf5edfa7"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/balancing-your-available-sql-server-core-licenses-evenly-across-numa-nodes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/glenn\/"},{"@type":"ListItem","position":2,"name":"Balancing Your Available SQL Server Core Licenses Evenly Across NUMA Nodes"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/glenn\/","name":"Glenn Berry","description":"Semi-random musings about SQL Server performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/glenn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/57a8972435106bac7970692fcf5edfa7","name":"Glenn Berry","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/glenn\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/64bdac8830f25f2f8cc780f8a1286c66ff1182218009271e7a953639596f7e25?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/64bdac8830f25f2f8cc780f8a1286c66ff1182218009271e7a953639596f7e25?s=96&d=mm&r=g","caption":"Glenn Berry"},"sameAs":["https:\/\/www.sqlskills.com\/blogs\/glenn\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/glenn\/author\/glenn\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/posts\/943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/comments?post=943"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/posts\/943\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/media?parent=943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/categories?post=943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/glenn\/wp-json\/wp\/v2\/tags?post=943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}