You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/database-engine/configure-windows/configure-persistent-memory.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This article describes how to configure the persistent memory (PMEM) for [!INCLU
16
16
17
17
## Overview
18
18
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.
20
20
21
21
> [!NOTE]
22
22
> 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
25
25
26
26
### Create namespaces for PMEM devices
27
27
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).
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.
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)].
:::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.":::
18
19
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 PMEMaware 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.
20
21
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.
22
23
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.
24
25
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.
26
27
27
28
For more information, see:
28
29
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).
31
32
32
33
## Enable hybrid buffer pool
33
34
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.
35
36
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)]:
37
38
38
39
```sql
39
40
ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED HYBRID_BUFFER_POOL =ON;
40
41
```
41
42
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.
43
44
44
45
The following example enables hybrid buffer pool for a specific database.
45
46
@@ -65,41 +66,47 @@ The following example disables hybrid buffer pool for a specific database.
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).
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).
88
95
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
90
97
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).
92
99
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.
94
101
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).
96
103
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.
98
105
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.
100
107
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.
102
109
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).
104
111
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.
0 commit comments