How It Works: How SQL Server Determines Logical and Physical Processors


Moved from: bobsql.com

 

SQL Server, as outlined in the following post (https://blogs.msdn.microsoft.com/psssql/2016/03/30/sql-2016-it-just-runs-faster-automatic-soft-numa) adjusts to various processor configurations.  I have received questions related to how SQL Server accomplishes the alignment on both bare metal and VM installations.

 

The key is the GetLogicalProcessorInformation API, and the same logic occurs on bare metal and VM based SQL Server installations.   For  Virtual Machine (VM) installations you may need to consult the VM documentation for support capabilities.

 

SQL Server uses Windows APIs to determine the processors and package interactions.

 

GetSystemInfo https://msdn.microsoft.com/en-us/library/windows/desktop/ms724381(v=vs.85).aspx GetLogicalProcessorInformation https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).aspx

The calls to GetLogicalProcessorInformation retrieve the RelationProcessorCore and RelationProcessorPackage details.   Using the returned information SQL Server