I witnessed an interesting conversation on Twitter today where someone was talking about how he uses the terms sockets and cores interchangeably, since everyone else does, or words to that effect. This made me think that there may still be some confusion about how these terms are used and what they mean in relation to SQL Server 2012 hardware selection and SQL Server 2012 licensing considerations.
The hierarchy works like this:
Physical socket on a motherboard where a physical processor fits (used for licensing before SQL Server 2012)
Physical core within a physical processor (multi-core, used for licensing with SQL Server 2012 Enterprise Edition)
Logical core within a physical core (hyper-threading)
Back in the prehistoric days of processor technology (around 2001) all Intel and AMD processors had only one core. If you wanted multiple threads of execution, you needed additional physical processors, since one socket = one physical processor = one physical core. Back then, the primary way to increase single-threaded performance was to increase the clock speed of the processor. Both Intel and AMD started running into problems with heat dissipation and power consumption as clock speeds approached 4.0GHz (on air cooling).
In 2002, Intel introduced the first processor with hyper-threading. Hyper-threading creates two “logical processors” within each physical processor core of an actual physical processor, that are visible to the operating system. Depending on the application, hyper-threading can improve performance by anywhere from 5-30%. The initial implementation of hyper-threading on the Pentium 4 Netburst architecture did not work as well on many server workloads (such as SQL Server), so the standard advice back then was to disable hyper-threading on database servers. The 2nd generation hyper-threading in the Intel Nehalem, Westmere, and Sandy Bridge processors works much better for SQL Server OLTP workloads, so I always leave it enabled by default.
In 2005, AMD introduced the first dual-core processor, the Athlon 64 X2. This processor had two discrete physical cores, which provided better multi-threaded performance than hyper-threading. A single, dual-core processor would have two processor cores visible to Windows. It is important to remember that Windows (and SQL Server) cannot tell the difference between hyper-threaded logical processors and true dual-core or multi-core processors.
In late 2006, Intel introduced the first Core2 Quad, which was a processor with four physical cores (but no hyper-threading). One of these processors would have four cores visible to Windows. Since then, both AMD and Intel have been rapidly increasing the physical core counts of their processors. AMD has the Opteron 63xx processor family which has 16 physical cores in a single physical processor. Intel has the Xeon E7 Family “Westmere-EX”, which has up to ten physical cores, plus 2nd generation hyper-threading, which means that you have a total of 20 logical cores visible to Windows and SQL Server for each physical processor.
Before SQL Server 2012, SQL Server licensing was only concerned with physical processor sockets, not physical cores, or logical cores. Knowing this, you wanted to always buy processors with as many cores as possible in order to maximize your overall processor performance per processor license. You should also be aware that SQL Server 2008 is limited to 64 logical processors. In order to use more than 64 logical processors, you must be running SQL Server 2008 R2 on top of Windows Server 2008 R2, which will raise your limit to 256 logical processors.
SQL Server 2008 R2 Enterprise Edition also had a license limit of eight physical processors (which would let you go up to 160 logical processors with eight Intel Westmere-EX processors). If you need more than eight physical processors, you needed to run SQL Server 2008 R2 Data Center Edition. Microsoft got rid of the Data Center Edition SKU for SQL Server 2012.
With SQL Server 2012, Microsoft completely changed their licensing model compared to previous releases. With SQL Server 2012 Enterprise Edition, in a non-virtualized environment, you must use core-based licensing, which is based on physical cores (not logical cores). Each processor socket must have at least four processor core licenses (even if there are actually only one or two physical cores). This means you need to be much more thoughtful about which exact processor model you select for your database server. Having lots of physical cores can add up to a very large amount of money for your SQL Server 2012 Enterprise Edition license costs. If you are running SQL Server 2012 Enterprise Edition on top of Windows Server 2012 Standard Edition, you can now have up to 640 logical cores, along with 4TB of RAM in your system.
This new licensing system really penalizes AMD processors, which can have up to 16 physical cores in each processor, but unfortunately, have pretty mediocre single-threaded performance. To try and level the playing field a little bit, Microsoft released something called the SQL Server Core Factor Table, which gives a 25% discount for most modern AMD processors that have six or more physical cores. Even with this discount, it is far more expensive to buy your SQL Server 2012 core licenses for an AMD system compared to an equivalent Intel system.
Remember that Windows and SQL Server cannot tell the difference between physical and logical cores. Running the query below will tell you how many logical cores are visible and how many physical CPUs you have.
1: -- Hardware information from SQL Server 2012
2: -- (Cannot distinguish between HT and multi-core)
3: SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS [Hyperthread Ratio],
4: cpu_count/hyperthread_ratio AS [Physical CPU Count],
5: physical_memory_kb/1024 AS [Physical Memory (MB)], committed_target_kb/1024 AS [Committed Target Memory (MB)],
6: max_workers_count AS [Max Workers Count], affinity_type_desc AS [Affinity Type],
7: sqlserver_start_time AS [SQL Server Start Time], virtual_machine_type_desc AS [Virtual Machine Type]
8: FROM sys.dm_os_sys_info WITH (NOLOCK) OPTION (RECOMPILE);
10: -- Gives you some good basic hardware information about your database server