Skip to content

Commit b2bc480

Browse files
authored
Merge pull request #26103 from MicrosoftDocs/release-2022-cu1
PUblish updated 2022 CU1 features
2 parents 6d48add + d769835 commit b2bc480

12 files changed

Lines changed: 1266 additions & 45 deletions

File tree

docs/database-engine/configure-windows/configure-persistent-memory.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This article describes how to configure the persistent memory (PMEM) for [!INCLU
1616

1717
## Overview
1818

19-
[!INCLUDE[sqlv15](../../includes/sssql19-md.md)] has a number of in-memory database features that rely on persistent memory. This document covers the steps required to configure persistent memory for SQL Server on Windows.
19+
[!INCLUDE[sqlv15](../../includes/sssql19-md.md)] has several in-memory database features that rely on persistent memory. This document covers the steps required to configure persistent memory for SQL Server on Windows.
2020

2121
> [!NOTE]
2222
> The term _enlightenment_ was introduced to convey the concept of working with a persistent memory aware file system. Direct access (DAX) extensions to the NTFS file system provide the ability to memory map files from kernel space to user space. When a file is memory mapped into user space the application can issue load/store instructions directly to the memory mapped file, bypassing the kernel I/O stack completely. This is considered an "enlightened" file access method. As of Windows Server 2022, this _enlightenment_ functionality is available on both Windows and Linux platforms.
@@ -25,7 +25,7 @@ This article describes how to configure the persistent memory (PMEM) for [!INCLU
2525

2626
### Create namespaces for PMEM devices
2727

28-
In Windows, use the `ipmctl` utility to configure the PMEM disks (referred to as namespaces in Linux). You can find Intel® Optane™ specific instructions [here](https://www.intel.com/content/www/us/en/developer/articles/guide/qsg-part3-windows-provisioning-with-optane-pmem.html). Details on supported PMEM hardware on different Windows versions are at [Understand and deploy persistent memory](/azure-stack/hci/concepts/deploy-persistent-memory#supported-hardware). PMEM disks should be interleaved across PMEM NVDIMMs and can provide different types of user-space access to memory regions on the device. For more on interleaved sets in Windows see [here](/azure-stack/hci/concepts/deploy-persistent-memory#understand-interleaved-sets).
28+
In Windows, use the `ipmctl` utility to configure the PMEM disks (referred to as namespaces in Linux). You can find Intel® Optane™ specific instructions [here](https://www.intel.com/content/www/us/en/developer/articles/guide/qsg-part3-windows-provisioning-with-optane-pmem.html). Details on supported PMEM hardware on different Windows versions are at [Understand and deploy persistent memory](/azure-stack/hci/concepts/deploy-persistent-memory#supported-hardware). PMEM disks should be interleaved across PMEM NVDIMMs and can provide different types of user-space access to memory regions on the device. For more information on interleaved sets in Windows, see [Understand and deploy persistent memory](/azure-stack/hci/concepts/deploy-persistent-memory#understand-interleaved-sets).
2929

3030
## PMEM disks
3131

@@ -61,7 +61,7 @@ Get-PmemUnusedRegion | New-PmemDisk -Atomicity None
6161
Get-PmemDisk | Initialize-Disk -PartitionStyle GPT
6262
6363
#Create New Partition(s) and Format the Volume(s) with DAX Mode
64-
Get-PmemDisk | `
64+
Get-PmemDisk[0] | `
6565
New-Partition `
6666
-UseMaximumSize `
6767
-AssignDriveLetter `
@@ -80,7 +80,7 @@ Format-Volume `
8080
Get-Partition | Select-Object DiskNumber, DriveLetter, IsDAX, Offset, Size, PartitionNumber | fl
8181
```
8282

83-
Check the file alignment of a particular file using `fsutil`. Note that our file size must be a modulo of 2 MB.
83+
Check the file alignment of a particular file using `fsutil`. Our file size must be a modulo of 2 MB.
8484

8585
```bash
8686
fsutil dax queryFileAlignment A:\AdventureWorks2019_A.mdf
@@ -90,7 +90,7 @@ fsutil dax queryFileAlignment A:\AdventureWorks2019_A.mdf
9090

9191
### Reprovision PMEM disks
9292

93-
Whenever a PMEM module is replaced, it needs to be re-provisioned.
93+
Whenever a PMEM module is replaced, it needs to be reprovisioned.
9494

9595
> [!NOTE]
9696
> Removing a PMEM disk will result in the loss of data on that disk.
@@ -101,7 +101,7 @@ Get-PmemDisk | Remove-PmemDisk -Confirm:$false
101101
```
102102
### Erase PMEM modules
103103

104-
To permanently erase data from PMEM modules use the `Initialize-PmemPhysicalDevice` PowerShell cmdlet.
104+
To permanently erase data from PMEM modules, use the `Initialize-PmemPhysicalDevice` PowerShell cmdlet.
105105

106106
```powershell
107107
# Reinitialize all PMEM disks
@@ -110,4 +110,4 @@ Get-PmemPhysicalDevice | Initialize-PmemPhysicalDevice -Confirm:$false
110110

111111
## See also
112112

113-
For other cmdlets for manipulating PMEM see [PersistentMemory](/powershell/module/persistentmemory/) in the PowerShell reference documentation.
113+
For other cmdlets for manipulating PMEM, see [PersistentMemory](/powershell/module/persistentmemory/) in the PowerShell reference documentation.
Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
11
---
2-
title: "Hybrid Buffer Pool"
3-
description: See how Hybrid Buffer Pool makes persistent memory devices accessible via the memory bus. Turn this SQL Server 2019 feature on or off, and view best practices.
2+
title: Hybrid buffer pool
3+
description: See how the hybrid buffer pool makes persistent memory devices accessible via the memory bus. Turn this SQL Server feature on or off, and view best practices.
44
author: briancarrig
55
ms.author: brcarrig
6-
ms.date: 10/19/2021
6+
ms.reviewer: randolphwest
7+
ms.date: 01/23/2023
78
ms.service: sql
89
ms.subservice: configuration
910
ms.topic: conceptual
1011
---
11-
# Hybrid Buffer Pool
12+
# Hybrid buffer pool
1213

13-
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
14+
[!INCLUDE [sqlserver2019](../../includes/applies-to-version/sqlserver2019-and-later.md)]
1415

15-
Hybrid Buffer Pool enables buffer pool objects to reference data pages in database files residing on persistent memory (PMEM) devices, instead of having to fetch copies of the data pages from disk and caching them in volatile DRAM. This feature was introduced in [!INCLUDE[sqlv15](../../includes/sssql19-md.md)] and is further enhanced in [!INCLUDE[sqlv16](../../includes/sssql22-md.md)].
16+
The hybrid buffer pool enables buffer pool objects to reference data pages in database files residing on persistent memory (PMEM) devices, instead of having to fetch copies of the data pages from disk and caching them in volatile DRAM. This feature was introduced in [!INCLUDE[sqlv15](../../includes/sssql19-md.md)] and is further enhanced in [!INCLUDE[sqlv16](../../includes/sssql22-md.md)].
1617

17-
![Hybrid Buffer Pool](./media/hybrid-buffer-pool.png)
18+
:::image type="content" source="media/hybrid-buffer-pool/hybrid-buffer-pool.svg" alt-text="Diagram showing the buffer pool, with and without the hybrid buffer pool enabled.":::
1819

19-
Persistent memory (PMEM) devices are byte-addressable and if a direct access (DAX) persistent-memory aware file system (such as XFS, EXT4, or NTFS) is used, files on the file system can be accessed using the usual file system APIs in the OS. Alternatively, SQL Server can perform what are known as load and store operations against memory maps of the files on the PMEM device. This allows PMEM aware applications such as SQL Server to access files on the device without traversing the traditional storage stack.
20+
Persistent memory (PMEM) devices are byte-addressable and if a direct access (DAX) persistent-memory aware file system (such as XFS, EXT4, or NTFS) is used, files on the file system can be accessed using the usual file system APIs in the OS. Alternatively, [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] can perform what are known as *load and store* operations against memory maps of the files on the PMEM device. This allows PMEM-aware applications such as [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] to access files on the device without traversing the traditional storage stack.
2021

21-
The hybrid buffer pool uses this ability to perform load and store operations against memory mapped files, to leverage the PMEM device both as a cache for the buffer pool and a storage location for the database files. This creates the unique situation where both a logical read and a physical read become essentially the same operation. Persistent memory devices are accessible via the memory bus just like regular volatile DRAM.
22+
The hybrid buffer pool uses this ability to perform load and store operations against memory mapped files, to use the PMEM device both as a cache for the buffer pool and a storage location for the database files. This creates the unique situation where both a logical read and a physical read become essentially the same operation. Persistent memory devices are accessible via the memory bus just like regular volatile DRAM.
2223

23-
By default, only clean data pages are cached on the PMEM module for the hybrid buffer pool. For a page to be modified and marked as dirty, it must be copied from the PMEM device to a DRAM buffer pool, modified and then eventually a copy of the modified page is written from DRAM back to the PMEM module, at which point it can be marked as clean again. This process occurs using normal background operations such as checkpoint, or the lazy writer, just as though the PMEM module were a standard block device.
24+
By default, only clean data pages are cached on the PMEM module for the hybrid buffer pool. For a page to be modified and marked as dirty, it must be copied from the PMEM device to a DRAM buffer pool, modified and then eventually a copy of the modified page is written from DRAM back to the PMEM module, at which point it can be marked as clean again. This process occurs using normal background operations such as checkpoint, or the lazy writer, as though the PMEM module were a standard block device.
2425

25-
The hybrid buffer pool feature is available for both Windows and Linux. The PMEM device must use a filesystem that supports DAX (DirectAccess). XFS, EXT4, and the NTFS file systems all have support for DAX extensions, which provides access to the filesystem directly from user space. SQL Server will detect if any database data files reside on an appropriately configured PMEM disk device and automatically perform the necessary memory mapping of the database files upon database startup, or whenever a database is attached, restored, or created.
26+
The hybrid buffer pool feature is available for both Windows and Linux. The PMEM device must use a filesystem that supports DAX (DirectAccess). XFS, EXT4, and the NTFS file systems all have support for DAX extensions, which provides access to the filesystem directly from user space. [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] will detect if any database data files reside on an appropriately configured PMEM disk device and automatically perform the necessary memory mapping of the database files upon database startup, or whenever a database is attached, restored, or created.
2627

2728
For more information, see:
2829

29-
* [Configure persistent memory (PMEM) for SQL Server on Windows](../configure-windows/configure-persistent-memory.md)(Beginning with SQL Server 2022).
30-
* [Configure persistent memory (PMEM) for SQL Server on Linux](../../linux/sql-server-linux-configure-pmem.md).
30+
- [Configure persistent memory (PMEM) for SQL Server on Windows](configure-persistent-memory.md) ([!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions).
31+
- [Configure persistent memory (PMEM) for SQL Server on Linux](../../linux/sql-server-linux-configure-pmem.md).
3132

3233
## Enable hybrid buffer pool
3334

34-
[!INCLUDE[sqlv15](../../includes/sssql19-md.md)] introduces dynamic data language (DDL) to control hybrid buffer pool.
35+
[!INCLUDE[sqlv15](../../includes/sssql19-md.md)] introduces dynamic data language (DDL) to control the hybrid buffer pool.
3536

36-
The following example enables hybrid buffer pool for an instance of SQL Server:
37+
The following example enables hybrid buffer pool for an instance of [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)]:
3738

3839
```sql
3940
ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED HYBRID_BUFFER_POOL = ON;
4041
```
4142

42-
By default, hybrid buffer pool is disabled at the instance scope. Note that in order for the setting change to take effect, the SQL Server instance must be restarted. A restart is needed to facilitate allocating sufficient hash pages, to account for the total PMEM capacity on the server.
43+
By default, hybrid buffer pool is disabled at the instance scope. In order for the setting change to take effect, the [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] instance must be restarted. A restart is needed to facilitate allocating sufficient hash pages, to account for the total PMEM capacity on the server.
4344

4445
The following example enables hybrid buffer pool for a specific database.
4546

@@ -65,41 +66,47 @@ The following example disables hybrid buffer pool for a specific database.
6566
ALTER DATABASE <databaseName> SET MEMORY_OPTIMIZED = OFF;
6667
```
6768

68-
By default, hybrid buffer pool is enabled at the database scope.
69+
By default, hybrid buffer pool is enabled at the database scope, and disabled at the server scope.
6970

7071
## View hybrid buffer pool configuration
7172

73+
### Show run time value
74+
7275
The following example returns the current hybrid buffer pool configuration status of the instance.
7376

7477
```sql
7578
SELECT * FROM
7679
sys.server_memory_optimized_hybrid_buffer_pool_configuration;
7780
```
7881

79-
The following example lists the databases and the database level setting for hybrid buffer pool (`is_memory_optimized_enabled`).
82+
The following example lists the databases and the database level setting for the hybrid buffer pool (`is_memory_optimized_enabled`).
83+
84+
You can also mount or format the PMEM module without DAX enabled, and treat it as a regular block device (that is, perform I/O via the kernel). When configured this way, no PMEM modules may be used by [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] to perform byte-addressable operations (that is, all calls will use kernel-space drivers).
8085

8186
```sql
8287
SELECT name, is_memory_optimized_enabled FROM sys.databases;
8388
```
8489

8590
## Hybrid buffer pool with direct write
8691

87-
Hybrid buffer pool with `Direct Write` behavior reduces the number of `memcpy` commands that need to be performed on modified data or index pages residing on PMEM devices. It does this by leveraging the durable persisted log buffer as a means to modify the page without having to copy it into one of the DRAM buffer pools. Instead pages in database files residing on PMEM devices are modified directly without the need to cache in a DRAM buffer pool and later asynchronously flush to disk. This behavior still adheres to write ahead logging (WAL) semantics, as the (log) records in the persisted transaction log buffer have been written, or hardened, to durable media. Considerable performance gains have been observed for transactional workloads using hybrid buffer pool and persisted log buffer together in this manner.
92+
The hybrid buffer pool with *Direct Write* behavior reduces the number of `memcpy` commands that need to be performed on modified data or index pages residing on PMEM devices. It does this by using the durable persisted log buffer as a means to modify the page without having to copy it into one of the DRAM buffer pools. Instead, pages in database files residing on PMEM devices are modified directly without the need to cache in a DRAM buffer pool and later asynchronously flush to disk. This behavior still adheres to write ahead logging (WAL) semantics, as the (log) records in the persisted transaction log buffer have been written, or hardened, to durable media. Considerable performance gains have been observed for transactional workloads using the hybrid buffer pool and persisted log buffer together in this manner.
93+
94+
To enable direct write mode, enable the hybrid buffer pool and [persisted log buffer](../../relational-databases/databases/add-persisted-log-buffer.md) for a database and enable startup [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
8895

89-
To enable direct write mode, enable hybrid buffer pool and [persisted log buffer](../../relational-databases/databases/add-persisted-log-buffer.md) for a database and enable startup [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
96+
## Best practices for hybrid buffer pool
9097

91-
## Best Practices for hybrid buffer pool
98+
- When formatting your PMEM device on Windows, use the largest allocation unit size available for NTFS (2 MB in Windows Server 2019 and later) and ensure the device has been formatted for DAX (Direct Access).
9299

93-
- When formatting your PMEM device on Windows, use the largest allocation unit size available for NTFS (2 MB in Windows Server 2019 and later) and ensure the device has been formatted for DAX (Direct Access).
100+
- Enable the [Lock pages in memory](./enable-the-lock-pages-in-memory-option-windows.md) policy on Windows.
94101

95-
- Use [Locked Pages in Memory](./enable-the-lock-pages-in-memory-option-windows.md) on Windows.
102+
- Files sizes should be a multiple of 2 MB (modulo 2 MB should equal zero).
96103

97-
- Files sizes should be a multiple of 2 MB (modulo 2 MB should equal zero).
104+
- If the server scoped setting for hybrid buffer pool is disabled, the feature won't be used by any user database.
98105

99-
- If the server scoped setting for hybrid buffer pool is disabled, the feature will not be used by any user database.
106+
- With the server scoped setting for hybrid buffer pool enabled, you can use the database scoped setting to disable the feature for individual user databases.
100107

101-
- If the server scoped setting for hybrid buffer pool is enabled, you can use the database scoped setting to disable the feature for individual user databases.
108+
- As of [!INCLUDE [sssql19-md](../../includes/sssql19-md.md)] CU 3 (see [KB4538118](https://support.microsoft.com/help/4538118)), read caching has been enabled by default, a process where the hottest pages are tracked in the hybrid buffer pool, then automatically promoted to a DRAM buffer pool to improve performance.
102109

103-
- When using [Persisted Log Buffer](../../relational-databases/databases/add-persisted-log-buffer.md), consider enabling start-up [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md) to reduce CPU overhead and improve overall performance. Especially, if the workload is highly transactional, involving multiple data and index page modifications.
110+
- As of [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] CU 1, *Direct Write* is the default behavior when the hybrid buffer pool is combined with [persisted log buffer](../../relational-databases/databases/add-persisted-log-buffer.md). This should improve performance for almost all workloads, but there is always a chance of regression and the CU should be tested thoroughly before being applied. If you experience regression due to this behavior change, you can revert to the previous behavior using the start-up [Trace Flag 898](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf898).
104111

105-
- As of [KB4538118](https://support.microsoft.com/en-us/topic/kb4538118-improvement-enable-hybrid-buffer-pool-read-caching-in-sql-server-2019-fb60b715-d1c6-5212-59f9-b76e546eacbd) read caching is enabled by default, with the hottest pages in the Hybrid buffer pool automatically promoted to a DRAM buffer pool to improve performance.
112+
- Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] CU 1, [Trace Flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf809) will be ignored by [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] at startup. Both Trace Flag 809 and [Trace Flag 898](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf898) apply to Windows only, and don't apply to [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] on Linux. The trace flags should only be used when directed to do so by a certified Microsoft Server professional.
Binary file not shown.

0 commit comments

Comments
 (0)