Wednesday, 13 January 2016

Skype for Business, SQL Server, and VMware

If you have deployed a virtualized Lync Server 2013 or Skype for Business infrastructure, and have followed the best practices, your Lync or Skype VMs will no doubt have multiple CPU cores.

If you have done this on VMware, and you let the VMware provisioning wizard automatically assign the CPUs, you may have a problem.

By default VMware will assign multiple CPU cores as multiple virtual CPU sockets, each with a single virtual core. This means that in an eight core server you have eight sockets. This fine for Lync or Skype, but represents a problem for the SQL Express installation that every front end server has, or indeed the SQL Server Standard installations you might be using for your back-end databases.

SQL Server Express is limited to "the lesser of 1 socket or 4 cores", which means that in the default VMware configuration SQL Express gets 1 core (because 1 socket has 1 core).

SQL Server Standard Edition is limited to "the lesser of 4 sockets or 16 cores", which means that if you have more than 4 virtual sockets, but only 1 virtual core per socket, SQL gets only 4 cores.

In order to give SQL Express access to more CPU resources you need to alter the virtual CPU allocation to put have fewer virtual sockets, with multiple virtual cores per socket.

To look for this issue in my VMware-based Skype for Business Environment I put together a brief script. The purpose is to report out the CPU configuration of all the servers which host a local management store replica (these servers have a local SQL Express instance), and all the back-end database servers.

Note that the script will fail to connect to Edge servers, and those should be checked manually.

# Get-SkypeServerCpuDetails.ps1
# Script to retrieve the CPU details of servers hosting Skype for Business SQL databases
# Ben Lye -

# Create an array of all the Skype for Business servers we are interested in
$Servers = @()
# Get the servers hosting replicas of the management store - these systems will have SQL Express Edition
$Servers = $Servers + @(Get-CsManagementStoreReplicationStatus | Where {$_.ProductVersion -ne ""} | Select-Object ReplicaFQDN -ExpandProperty ReplicaFQDN)
# Get the Application Database servers - these will be SQL Server Standard Edition or Enterprise Edition
$Servers = $Servers + @(Get-CsService -ApplicationDatabase | Select-Object PoolFqdn -ExpandProperty PoolFqdn)
# Get the Persistent Chat database servers
$Servers = $Servers + @(Get-CsService -PersistentChatDatabase | Select-Object PoolFqdn -ExpandProperty PoolFqdn)

# Create an array for the output
$Output = @()

# Loop through each of the servers
$Servers | % { 
 # Create an object to store the output in
 $Object = New-Object –TypeName PSObject
 $Object | Add-Member –MemberType NoteProperty –Name HostName –Value $_
 # Use WMI to get the details of the processor(s) from the system
 If ($ServerProcs = @(Get-WmiObject win32_processor -ComputerName $_)) {
  # Populate the output object with details of the processors
  $Object | Add-Member –MemberType NoteProperty –Name CpuDescription –Value ($ServerProcs[0].Name -replace '\s+', ' ')
  $Object | Add-Member –MemberType NoteProperty –Name CpuSockets –Value $ServerProcs.Count
  $Object | Add-Member –MemberType NoteProperty –Name CpuCoresPerSocket –Value $ServerProcs[0].NumberOfCores
  $Object | Add-Member –MemberType NoteProperty –Name TotalCpuCores –Value ($ServerProcs.Count * $ServerProcs[0].NumberOfCores)
 # Append the output object to the output array
 $Output = $Output + $Object

# Return the output
Return $Output
Download Script

The script doesn't give information about which version of SQL Server each system is running, so you'll need to know that in order to determine if there is actually a problem in the resulting output.

- Ben

No comments:

Post a comment

Note: only a member of this blog may post a comment.