Numa explanation

The original path: http: //www.sohu.com/a/126402403_609500

 

Executive Summary Today's article we will simply learn how to accelerate virtual machine memory access by NUMA (Non-Uniform Memory Access) under Hyper-V.

SMP sum NUMA

1

CPU time and distance required to access the memory address may be in accordance with our structure is divided into the CPU and memory SMP (SMP, Symmetric Multi-Processor, also known Uniform Memory Access UMA), and three structures NUMA MPP (Massive Parallel Processing) . , NUMA have more good scalability. NUMA CPU and memory paired into similar nodes in each NUMA node years, CPU has a local memory, a short distance access, good performance. Better than NUMA SMP scalability, SMP using shared memory controller, all CPU memory using the shared memory access bus, as shown in FIG. In much of the CPU time ,, it can also occur with each other "scramble" to access the shared memory bus between the CPU. ,as shown in picture 2. In the server CPU and the growing popularity of virtualization era, NUMA can adapt to the requirements of high-density virtualized environments.

figure 1

figure 2

NUMA topology mapping of virtual machines

2

那么虚机是否能用到NUMA的特性呢?从Windows Server 2012开始,Hyper-V虚机可以映射虚拟的NUMA拓扑,在虚机配置了较多内存的时候,使用NUMA拓扑映射能保证分配给虚机的CPU只访问本地的内存,从而达到提升性能。Hyper-V为虚机提供虚拟NUMA节点,虚拟NUMA的拓扑结构及原理与物理机的NUMA拓扑及结构一致,虚拟CPU和虚机内存组合成虚拟NUMA节点,每个虚机的虚拟NUMA节点都映射到相关的物理CPU上,如图3所示。Hyper-V虚机能够感知物理机NUMA拓扑并在启用NUMA时进行默认映射,通常如果虚机虚拟CPU没有超过物理机单颗CPU的核数,那么通常只生成一个虚机NUMA节点。虽然我们可以进行自定义给虚机分配设置多个虚拟NUMA节点,但是跨NUMA节点的拓扑偏离了物理机的拓扑结构,会影响性能的提升速度,所以在一些高负载应用场景下不建议不经规划设置多个虚拟NUMA节点。

图3

举个例子,物理机有两颗CPU,每颗CPU有20个逻辑核,因此该物理机一共有40个逻辑核和256GB内存,所以每个CPU逻辑核对应约6.4GB内存。每颗CPU和它临近的内存组成一个NUMA拓扑节点,因此物理机一共有两个NUMA节点,每个NUMA节点包含20个逻辑核和128GB内存,如果虚机启用NUMA映射,那么这个虚机的NUMA节点拓扑里包含最大的虚拟CPU数是20,内存数是128GB,如图4所示。

图4

虚拟NUMA也支持跨物理NUMA,如果单个虚拟NUMA超过了单个物理NUMA节点的CPU数量,可能会出现虚机NUMA拓扑和物理机NUMA拓扑出现偏离的情况,导致CPU访问远程内存的情况发生,如图5所示。因为远程内存的访问速度比本地内存访问速度慢,因此可能导致性能提升没有在NUMA拓扑内那么明显。

图5

举个例子,给虚拟NUMA拓扑设置成最多10个虚拟CPU,那么依据当前的环境,按照NUMA拓扑的最大内存应该限制在64GB内存,如果虚机分配了10个CPU和超过64GB内存,则虚拟机必然要访问其NUMA节点之外的远程内存。同理,如果虚机的NUMA节点的CPU超过了物理机NUMA节点的CPU,这些CPU也将访问其他NUMA节点的远程内存。

要查看物理机的NUMA拓扑,可以在服务器系统的任务管理器查看,也可以使用PowerShell命令查看。在系统里打开任务管理器,再打开资源监视器,选择CPU选项卡后,可以查看到NUMA的节点数和每个节点的CPU使用情况,如图6所示。

图6

使用PowerShell命令Get-VMHostMumaNode可以查看物理机的NUMA节点更加详细的信息,包括内存以及剩余内存,如下示例所示。

 

NodeId

: 0

ProcessorsAvailability

: {0, 0, 0, 0...}

MemoryAvailable

: 38459

MemoryTotal

: 131035

ComputerName

: Host01

   

NodeId

: 1

ProcessorsAvailability

: {0, 0, 0, 0...}

MemoryAvailable

: 38470

MemoryTotal

: 131072

ComputerName

: Host01

作者介绍

黄利军老师特别授权华来四发表的作品,共有12篇,摘自其最新书作《软件定义数据中心技术与实践-Windows Server SDDC》,京东、当当等都有售。

Guess you like

Origin www.cnblogs.com/smlie/p/11546478.html