SQL Server Microsoft PMem vSphere

Using Persistent memory with a virtual Microsoft SQL Server – vPMem mode

We’re continuing our blog series dedicated to the great persistent memory technology. In the Part I we discussed the way of configuring a PMem device on an ESXi host. In this part we will cover how an instance of Microsoft SQL Server (further referenced as SQL Server) can consume virtual NVDIMM device in vPMem (Direct-access mode, shown on the left in the figure below).

https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.storage.doc/images/GUID-BB499BC6-747B-4394-8B11-263CFCE82F3B-high.png

The vPMem mode provides the best way to consume a NVDIMM device by an instance of SQL Server running on a virtual machine (VM), but has number of prerequisites:

  • Virtual Machine must have compatibility mode set to the hardware version 14. The VM cannot be run on any ESXi host with the version 6.5 or above.
  • ESXi host hosting a VM must be on the vSphere version 6.7 or above.
  • Guest operating system must support NVDIMM in so called DAX mode. This support for Windows operating system was introduced starting with Windows Server 2016.
  • SQL Server must support the DAX-mode enabled device. This support was introduced by SQL Server 2016 SP1.

If all prerequisites are in place, a SQL Server database can be configured to use the “tail-of-log-cache” feature, when one of the database log flies is placed on a virtual NVDIMM device, providing significant performance improvement especially for In-memory optimized databases as shown here and here. Let us explore, how to configure the “tail-of-log-cache” SQL Server feature on the vSphere platform.

Adding NVDIMM to a VM

First, a VM must be created or already existing VM might be taken (check prerequisites below in this case carefully). The VM must be powered off in order to add a virtual NVDIMM device. Use vSphere (HTML5) Client, navigate to the VM and select Edit in the drop-down menu. Select NVDIMM from the “Add new device” list:

Specify the size of the vPMem device to be present. Virtual NVDIMM controller will be created automatically.

NOTE: The recommended vPMem size is 256 MB. SQL Server is using only 20 MB to allocate “tail-of-log-cache” and 256MB is the minimum requirement for a GPT partition, which is a prerequisites for creating a DAX volume.

Formating vPmem device in Windows OS

After a VM is powered on and the OS is booted, a new physical disk will be found (All NVDIMM backend device will be operated in the same manner as usual disks, including file operations). Confirm, that a Storage Class Memory (SCM) type physical disk device is present using PowerShell. The SCM device type is a requirement for the DAX access:

Get-PhysicalDisk | select bustype, healthstatus, size | sort bustype

Proceed with the disk initialization using the Disk management tool:

  • Initialize the disk as a GPT partition
  • Proceed with a creation of volume, do not format, take notice of the volume letter

Switch back to the PowerShell console and format the new volume using the NTFS file system with /dax option

format e: /dax /q

Verify that the volume is formatted as a “DAX volume”

fsutil fsinfo volumeinfo e:

Now we can proceed with the SQL Server database configuration.

Configuring SQL Server database to use vPMem device

Open SQL Server Management Studio and connect to the SQL Server instance, select the database that will use “tail-of-log-cache” and add a log file placed on the previously created DAX-enabled volume:

ALTER DATABASE <MyDB> ADD LOG FILE (NAME = <DAXlog>,
FILENAME = ‘<Filepath to DAX Log File>’, SIZE = 20 MB

Check the folder on your vPMem backend disk to ensure that a 20MB log file was created.

Start you preferable benchmarking tool and compare the difference! The following results were obtained in this setup

All steps described in this blogs are also depicted in the demo.

Current limitations for a VM with a vPMem device attached:

  • VM with a vPMem device will be not protected by the vSphere HA.
  • VM with a vPMem must be excluded from a VM level backup. If a VM was previously part of such backup, ensure to disable CBT before adding vNVDIMM to a VM.
  • VM with vPMem can be vMotioned, but a destination host must have a hardware NVDIMM device.

This configuration provides performance benefits for databases and allows to efficiently share even small in size hardware NVDIMM module between many VMs and many databases, providing very efficient way of consuming the new hardware. With a support of the persistent memory technology in vSphere 6.7, it’s looks very beneficial from SQL Server performance perspective to enhance the hardware configuration of a new server with NVDIMM devices.

Special thanks Chris Gully for helping with the hardware configuration  and perfomance testing. Following DellEMC hardware platform specifications were used:

Manufacturer Dell Inc.
Model PowerEdge R740
CPU Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz
Sockets 2
Cores per socket 14
Hyperthreading Yes, enabled
Memory 383.44 GB
Persistent Memory 4 x Micron 16GB (Total 63.98 GB)
Storage SSD 1 x Intel 4600 1.75 TB SSD
Storage Controller Perc H740
Boot Device 2 x IDSDM 16Gb SD (RAID1)