Licensing SQL Server and Affinity Masking

What happens if you have a SQL Server that was initially built and licensed for a heavier load than what currently exists? Maybe the databases on the server have been optimized to no longer require as much power. Perhaps for one reason or another the busiest databases have been moved to other servers. If you have a physical server not utilizing much CPU, can you use affinity masking to get around licensing cores?

To Affinity and Beyond

Let’s take a look at how to change affinity. In SSMS, right click on your server in Object Explorer and select Properties. From the Server Properties window, select Processors. Click the plus signs to expand and you should see something like this with your CPUs:

There are options for Processor Affinity (thread scheduling) and I/O Affinity (I/O specific tasks).

Since our checkboxes to automatically set affinity are both checked, there is no way to select the check box next to CPU0, CPU1, etc. If we uncheck both boxes at the top, we can make processor and I/O affinity changes:

But Why?

By changing these values, we limit what processors SQL Server will use for scheduling work. This could be helpful if our server is getting slammed and we’re trying to reduce context switching. You may also want to specify values if you’re running two instances of SQL Server side by side and want half the CPUs for one instance and half for the other instance.

In my experience, these scenarios have been rare. It’s best to let SQL Server do what’s best for the average install and automatically handle processors.

Back to the Question…

I mentioned a few scenarios where affinity changes can be helpful. Can it be helpful to reduce the cost of SQL Server?

In the simplest of terms, the answer is “no.” If your SQL Server has X amount of cores, those X cores all need to be licensed.

Changing settings with affinity masking does not matter. Even disabling cores in the server BIOS does not matter. If the server has a core, that core needs a license.

Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s