0

Is it possible to add more CPU to a VM running SQL but for OS use only?

We have a SQL 2019 std VM that was already provisioned with 4 cores. We noticed antivirus is using CPU a lot. We want to add 4 more cores just for OS processes to use. It will make the VM total cores count to 8 now.

Can CPU affinity in SQL be set to 4 cores so we stay compliant with Microsoft licensing? If not is there another way?

1
  • 1
    The licensing aspect of the question is off-topic, but you still might get some useful answers on the configuration side of things. But keep in mind, you must license all cores that are presented to the operating system environment on which SQL runs, even if you don't let SQL use them.
    – Doug Deden
    Commented Oct 21 at 22:02

2 Answers 2

2

There's a SQL Server doc on how to Configure antivirus software to work with SQL Server which I recommend you take a look, as it might help in your case without risking having compliance problems (they're off-topic as already mentioned in comment).

Here's an excerpt from the Directories and file name extensions to exclude from virus scanning section of the doc:

When you configure your antivirus software settings, make sure that you exclude the following files or directories (as applicable) from virus scanning. Exclusion may improve SQL Server performance and ensures that the files aren't locked when the SQL Server service must use them. However, if these files become infected, your antivirus software can't detect the infection. For more information about the default file locations for SQL Server, see File Locations for Default and Named Instances of SQL Server.

In the files listed you can find:

  • SQL Server data files
  • SQL Server backup files
  • Full-Text catalog files
  • Trace files
  • Extended Event file targets
  • SQL audit files
  • SQL query files
  • Filestream data files
  • Remote Blob Storage files
  • Exception dump files
  • In-memory OLTP files
  • DBCC CHECKDB files

It's possible the high processing consumption of the antivirus you mentioned comes from scanning big database files, so removing them from scan might reduce that overload, hence not requiring adding more CPU to the VM.

0

It might require reconfig of the entire vm. Since SQL server 2019 has a max of 4 sockets or 24 cores, could configure the vm 8 sockets with 1 core each. Then sql server will only use 4 of the 8 sockets on the server. You can verify by messages in the sql server log or using sys.dm_os_schedulers. Offline would mean not used by SQL Server(you could probably verify this as well for setting CPU affinity, cant speak to licensing though)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.