配置具有 NVDIMM-N 回写式缓存的存储空间

适用于:SQL Server

Windows Server 2016 支持允许以极快地速度进行输入/输出 (I/O) 操作的 NVDIMM-N 设备。 使用这种设备的一种新颖方式是作为回写式缓存来实现低写入延迟。 本文讨论如何将具有镜像 NVDIMM-N 回写式缓存的镜像存储空间设置为虚拟驱动器,以存储 SQL Server 事务日志。 如果你也打算利用其来存储数据表或其他数据,则你可能需在存储池中包含更多磁盘,或创建多个池(如果隔离很重要)。

确定正确的磁盘

在 Windows Server 2016 中安装存储空间,尤其是安装具有高级功能(例如回写式缓存)的存储空间可非常轻易地通过 PowerShell 实现。 第一步是确定该存储空间池(将从此池创建虚拟磁盘)要包括的磁盘。 NVDIMM-N 具有 SCM(存储级内存)的介质类型和总线类型,可通过 Get-PhysicalDisk PowerShell cmdlet 查询。

Get-PhysicalDisk | Select FriendlyName, MediaType, BusType  

Screenshot of a Windows Powershell window showing the output of the Get-PhysicalDisk cmdlet.

注意

使用 NVDIMM-N 设备,你不再需要具体选择可作为回写式缓存目标的设备。

若要生成带镜像回写式缓存的镜像虚拟磁盘,至少需要两个 NVDIMM-N 和其他两个磁盘。 生成池前,将所需物理磁盘分配到一个变量可使此过程更简单。

$pd =  Get-PhysicalDisk | Select FriendlyName, MediaType, BusType | WHere-Object {$_.FriendlyName -like 'MK0*' -or $_.FriendlyName -like '2c80*'}  

屏幕截图显示 $pd 变量,还显示它使用以下 PowerShell cmdlet 分配返回的两个 SSD 和两个 NVDIMM-N:

$pd | Select FriendlyName, MediaType, BusType  

Screenshot of a Windows Powershell window showing the output of the $pd cmdlet.

创建存储池

借助包含 PhysicalDisks 的 $pd 变量,可通过 New-StoragePool PowerShell cmdlet 轻松创建存储池。

New-StoragePool -StorageSubSystemFriendlyName "Windows Storage*" -FriendlyName NVDIMM_Pool -PhysicalDisks $pd  

Screenshot of a Windows Powershell window showing the output of the New-StoragePool cmdlet.

创建虚拟磁盘和卷

现已创建一个池,下一步是分出一个虚拟磁盘并对其进行格式化。 在这种情况下,将只创建一个虚拟磁盘,并且可使用 New-Volume PowerShell cmdlet 来简化该过程:

New-Volume -StoragePool (Get-StoragePool -FriendlyName NVDIMM_Pool) -FriendlyName Log_Space -Size 300GB -FileSystem NTFS -AccessPath S: -ResiliencySettingName Mirror  

Screenshot of a Windows Powershell window showing the output of the New-Volume cmdlet.

该虚拟磁盘已通过 NTFS 创建、初始化并格式化。 下面的屏幕截图显示其大小为 300GB,回写式缓存大小为 1GB(将托管于 NVDIMM-N 上)。

Screenshot of a Windows Powershell window showing the output of the Get-VirtualDisk cmdlet.

现在你可查看服务器中可见的这一新卷。 现在你可对 SQL Server 事务日志使用此驱动器。

Screenshot of a File Explorer window on the This PC page showing the Log_Space drive.

后续步骤