Its always important to look at the License type of your SQL Server!!!
We recently had an issue with CPU utilization reaching more than 95% always for database server in one of our performance test environment. Load test environments are resource intensive test, hence it is expected to have high CPU utilization. However, we could observe the number of tests processed and number of transactions are very less spiking the CPU utilization to 95%.
Let me explain a bit more on my environment, We have 4 sockets with 10 physical cores and HT enabled in our test environment. As per the configuration we have total 80 logical CPU available. SQL Server version information as below:
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) Jun 17 2016 19:14:09 Copyright (c) Microsoft Corporation Enterprise Edition ((missing))Core based Licensing>((missing)) (64-bit) on Windows NT 6.3 (Build 9600: )
Here we can observe that the version information is missing “Core based Licensing”, that means, the SQL version is not Core based, but CAL based. Let us look at the excerpt from the MSDN article:
“Enterprise Edition with Server + Client Access License (CAL) based licensing (not available for new agreements) is limited to a maximum of 20 cores per SQL Server instance. There are no limits under the Core-based Server Licensing model”
So, though we have 4 sockets with 10 Cores, ONLY 20 cores are VISIBLE for SQL Server. In our environment, this was 20*2(HT enabled) = 40 Logical CPUs are visible.
Lets confirm the above with other parameters DMV -sys.dm_os_schedulers.
Select parent_node_id,Count(cpu_id) Total_Schedulers, count(Case when Status = 'VISIBLE ONLINE' Then 1 Else null End) Visible_Count, count(Case when Status = 'VISIBLE OFFLINE' Then 1 Else null End) NotVisible_Count From sys.dm_os_schedulers where status in ('VISIBLE ONLINE','VISIBLE OFFLINE') and parent_node_id not in (64)--DAC Group by parent_node_id
The result looks like below:
Once we upgraded the license to Core Based License, we were able to use all available CPUs in our environment and observed the database CPU utilization has come down to 65% resulting more number of tests and transactions.
Let me reiterate, Its always important to look at the License type of your SQL Server !!!