With a NUMA configuration, every node has some
subset of the machine’s processors and the same number of schedulers. If the
machine is configured for hardware NUMA, the number of processors on each node
will be preset, but for soft-NUMA that you
configure yourself, you can decide how many processors are assigned to
each node.
There is still the same number of schedulers as processors, however.
When SPIDs are first created, they are
assigned to nodes on a round-robin basis. The Scheduler Monitor then
assigns the SPID to the least loaded scheduler on that node. As mentioned
earlier, if the SPID is moved to another scheduler, it stays on the same node.
A single processor or SMP machine will
be treated as a machine with a single NUMA node. Just like on an SMP machine, there is no hard mapping between
schedulers and a CPU with NUMA, so any scheduler on an individual node can run
on any CPU on that node. However, if you have set the Affi nity Mask Confi
guration option, each scheduler on each node will be fi xed to run on a
particular CPU.
Every NUMA node has its own as well as its own
I/O Completion Port (IOCP), which is the network listener. Every node also has
its own Resource Monitor, which is managed by a hidden scheduler. You can see
the hidden schedulers in sys.dm_os_schedulers. Each Resource Monitor has its own SPID, which
you can see by querying the sys.dm_exec_requests
and sys.dm_os_workers DMVs, as shown here:
SELECT session_id, CONVERT (varchar(10),
t1.status) AS status, CONVERT (varchar(20), t1.command) AS command, CONVERT
(varchar(15), t2.state) AS worker_state
FROM sys.dm_exec_requests AS t1 JOIN
sys.dm_os_workers AS t2 ON t2.task_address = t1.task_address WHERE command =
'RESOURCE MONITOR';
Every node has its own Scheduler Monitor, which
can run on any SPID and runs in a preemptive mode. The Scheduler Monitor is a
thread that wakes up periodically and checks each scheduler to see if it has
yielded since the last time the Scheduler Monitor woke up (unless the scheduler
is idle). The Scheduler Monitor raises an error (17883) if a nonidle thread has
not yielded. The 17883 error can occur when an application other than SQL
Server is monopolizing the CPU. The Scheduler Monitor knows only that the CPU
is not yielding; it can’t ascertain what kind of task is using it. The
Scheduler Monitor is also responsible for sending messages to the schedulers to
help them balance their workload.