我正在尝试在 2 节点 NUMA 服务器上分配一组 CPU,如下所示:
以下来自 coreinfo,显示了服务器上的物理处理器、逻辑处理器和 NUMA 节点。
Logical to Physical Processor Map:
**-------------- Physical Processor 0 (Hyperthreaded)
--**------------ Physical Processor 1 (Hyperthreaded)
----**---------- Physical Processor 2 (Hyperthreaded)
------**-------- Physical Processor 3 (Hyperthreaded)
--------**------ Physical Processor 4 (Hyperthreaded)
----------**---- Physical Processor 5 (Hyperthreaded)
------------**-- Physical Processor 6 (Hyperthreaded)
--------------** Physical Processor 7 (Hyperthreaded)
Logical Processor to Socket Map:
********-------- Socket 0
--------******** Socket 1
Logical Processor to NUMA Node Map:
********-------- NUMA Node 0
--------******** NUMA Node 1
我正在运行 2 个 sql server 2008R2 标准版实例。
我所做的是:
将NODE 0 绑定到实例 1。因此实例1将有 8 个逻辑处理器。
ALTER SERVER CONFIGURATION SET PROCESS AFFINITY NUMANODE = 0
GO
2013-11-07 13:01:20.79 Server Processor affinity turned on: node 0, processor mask 0x00000000000000ff. Threads will execute on CPUs per affinity settings. This is an informational message; no user action is required.
2013-11-07 13:01:20.79 Server Processor affinity turned on: node 1, processor mask 0x0000000000000000. Threads will execute on CPUs per affinity settings. This is an informational message; no user action is required.
2013-11-07 13:01:20.82 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2013-11-07 13:01:20.82 Server Lock partitioning is enabled. This is an informational message only. No user action is required.
2013-11-07 13:01:20.83 Server Node configuration: node 0: CPU mask: 0x00000000000000ff:0 Active CPU mask: 0x00000000000000ff:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2013-11-07 13:01:20.83 Server Node configuration: node 1: CPU mask: 0x000000000000ff00:0 Active CPU mask: 0x0000000000000000:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
我可以看到实例 1 能够监听 NODE 0,如下所示:
2013-11-07 13:01:21.05 服务器 SQL Server 网络接口在节点关联掩码 0x0000000000000001 的多节点 (NUMA) 服务器配置的节点 0 上初始化侦听器。这只是一条信息性消息。无需用户操作。
现在在实例 2 上:
将NODE 1 绑定到实例 2。因此实例2将有 8 个逻辑处理器。
ALTER SERVER CONFIGURATION SET PROCESS AFFINITY NUMANODE = 1
GO
错误日志也证实了这一点:
2013-11-07 13:03:51.16 Server Detected 16 CPUs. This is an informational message; no user action is required.
2013-11-07 13:03:51.49 Server Processor affinity turned on: node 0, processor mask 0x000000000000ff00. Threads will execute on CPUs per affinity settings. This is an informational message; no user action is required.
2013-11-07 13:03:51.49 Server Processor affinity turned on: node 1, processor mask 0x0000000000000000. Threads will execute on CPUs per affinity settings. This is an informational message; no user action is required.
2013-11-07 13:03:51.52 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2013-11-07 13:03:51.52 Server Lock partitioning is enabled. This is an informational message only. No user action is required.
2013-11-07 13:03:51.53 Server Node configuration: node 0: CPU mask: 0x000000000000ff00:0 Active CPU mask: 0x000000000000ff00:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2013-11-07 13:03:51.53 Server Node configuration: node 1: CPU mask: 0x00000000000000ff:0 Active CPU mask: 0x0000000000000000:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
但是为什么 INSTANCE2 监听 NUMA 0 而不是 NUMA 1 呢?
两个实例都将 MAXDOP 设置为 4。
2013-11-07 13:03:51.78 服务器 SQL Server 网络接口在节点关联掩码 0x0000000000000001 的多节点 (NUMA) 服务器配置的节点 0 上初始化侦听器。这只是一条信息性消息。无需用户操作。
此外,以下是我的 TCP/IP 设置:
笔记:
我也尝试过以下事情:
先关闭 CPU 亲和力,然后绑定端口,看看是否有效。这工作正常,我能够看到 NUMA 0 在一个端口上侦听,NUMA 1 在第二个端口上侦听。这就是我想要的,但我不想关闭 CPU Affinity。我的方向正确吗?
CPU 亲和力开启。尝试 NUMA 分配给端口。这在实例 1 绑定到 NUMA 0 并且实例 2 未在错误日志中显示它正在侦听 NUMA 1 的意义上不起作用。
谢谢 !
由于您已经使用 ALTER SERVER CONFIGURATION 将每个实例关联到一个 NUMA 节点,这就是您需要做的全部,并且此设置不需要端口映射。不需要它的原因是实例只能将任务分配给 ONLINE 节点,并且因为每个实例只有一个 ONLINE 节点,所有任务都必须作为实例的 CPU 关联的一部分分配。在 Soft NUMA 中,您可以在各个实例中进一步细分和隔离,但我认为根本没有理由这样做。