Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit d230eda

Browse files
authored
Merge pull request #24288 from MicrosoftDocs/release-dallas
Publish SQL Server 2022 RC 0
2 parents d13fd9a + 39b60f7 commit d230eda

8 files changed

Lines changed: 190 additions & 51 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Configure persistent memory (PMEM) - Windows
3+
description: Learn how to configure persistent memory (PMEM) for SQL Server on Windows, and how to create namespaces for PMEM devices.
4+
author: briancarrig
5+
ms.author: brcarrig
6+
ms.reviewer: mikeray
7+
ms.date: 09/21/2022
8+
ms.topic: conceptual
9+
ms.prod: sql
10+
ms.technology: configuration
11+
---
12+
13+
# Configure persistent memory (PMEM) for SQL Server on Windows
14+
15+
This article describes how to configure the persistent memory (PMEM) for [!INCLUDE[sqlv14](../../includes/sssql16-md.md)] and above on Windows.
16+
17+
## Overview
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.
20+
21+
> [!NOTE]
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.
23+
24+
## Configure the devices
25+
26+
### Create namespaces for PMEM devices
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).
29+
30+
## PMEM disks
31+
32+
### Use PowerShell to examine PMEM disks
33+
34+
```powershell
35+
#Get information about all physical disks
36+
Get-PhysicalDisk
37+
38+
#Review logical configuration of PMEM disks
39+
Get-PmemDisk
40+
41+
#Get information about PMEM devices
42+
Get-PmemPhysicalDevice
43+
44+
#Get information about unused PMEM regions
45+
Get-PmemUnusedRegion
46+
```
47+
48+
### BTT and DAX
49+
50+
By default, `New-PmemDisk` will use the desired `FSDax` mode. Atomicity is set to the default of `None` rather than `BlockTranslationTable`. From a support perspective, BTT must be enabled for the transaction log, to mimic required sector mode semantics. Although use of [BTT](/azure-stack/hci/concepts/deploy-persistent-memory#block-translation-table) with NTFS is generally recommended, BTT is not recommended when using large pages, such as required for [DAX](/windows-server/storage/storage-spaces/persistent-memory-direct-access#dax-and-block-translation-table-btt).
51+
52+
```powershell
53+
Get-PmemUnusedRegion | New-PmemDisk -Atomicity None
54+
```
55+
56+
### Formatting the NTFS volume(s)
57+
58+
```powershell
59+
60+
#Initialize PMEM Disk(s)
61+
Get-PmemDisk | Initialize-Disk -PartitionStyle GPT
62+
63+
#Create New Partition(s) and Format the Volume(s) with DAX Mode
64+
Get-PmemDisk | `
65+
New-Partition `
66+
-UseMaximumSize `
67+
-AssignDriveLetter `
68+
-Offset 2097152 `
69+
-Alignment 2097152 | `
70+
Format-Volume `
71+
-FileSystem NTFS `
72+
-IsDAX:$True `
73+
-AllocationUnitSize 2097152
74+
```
75+
## File alignment and offset
76+
77+
### Check partition offset(s)
78+
79+
```powershell
80+
Get-Partition | Select-Object DiskNumber, DriveLetter, IsDAX, Offset, Size, PartitionNumber | fl
81+
```
82+
83+
Check the file alignment of a particular file using `fsutil`. Note that our file size must be a modulo of 2 MB.
84+
85+
```bash
86+
fsutil dax queryFileAlignment A:\AdventureWorks2019_A.mdf
87+
```
88+
89+
## Replacing PMEM
90+
91+
### Reprovision PMEM disks
92+
93+
Whenever a PMEM module is replaced, it needs to be re-provisioned.
94+
95+
> [!NOTE]
96+
> Removing a PMEM disk will result in the loss of data on that disk.
97+
98+
```powershell
99+
# Remove all PMEM disks
100+
Get-PmemDisk | Remove-PmemDisk -Confirm:$false
101+
```
102+
### Erase PMEM modules
103+
104+
To permanently erase data from PMEM modules use the `Initialize-PmemPhysicalDevice` PowerShell cmdlet.
105+
106+
```powershell
107+
# Reinitialize all PMEM disks
108+
Get-PmemPhysicalDevice | Initialize-PmemPhysicalDevice -Confirm:$false
109+
```
110+
111+
## See also
112+
113+
For other cmdlets for manipulating PMEM see [PersistentMemory](/powershell/module/persistentmemory/) in the PowerShell reference documentation.

docs/database-engine/configure-windows/hybrid-buffer-pool.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ ms.technology: configuration
1010
ms.topic: conceptual
1111
---
1212
# Hybrid Buffer Pool
13+
1314
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.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 copies of the data pages cached in volatile DRAM. This feature is introduced in [!INCLUDE[sqlv15](../../includes/sssql19-md.md)].
16+
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

1718
![Hybrid Buffer Pool](./media/hybrid-buffer-pool.png)
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, it can perform what is known as load and store operations against memory maps of the files on the 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, 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.
2021

21-
The hybrid buffer pool uses this ability to perform load and store operations against memory mapped files, to leverage the PMEM device as cache for the buffer pool and storing database files. This creates the unique situation where both a logical read and a physical read are 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 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.
2223

23-
Only clean data pages are cached on the device for the hybrid buffer pool. When a page is marked as dirty, it is copied to the DRAM buffer pool before eventually being written back to the PMEM device and marked as clean again. This page maintenance will occur during regular checkpoint operations in a manner similar to that performed against 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, just 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 be formatted with a filesystem that supports DAX (DirectAccess). XFS, EXT4, and NTFS file systems all have support for DAX. SQL Server will automatically detect if data files reside on an appropriately formatted PMEM device and perform memory mapping of database files upon startup, when a new 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. 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.
2627

2728
For more information, see:
2829

29-
* [Understand and deploy persistent memory (Windows)](/windows-server/storage/storage-spaces/deploy-pmem/)
30-
* [Configure persistent memory (PMEM) for SQL Server on Linux](../../linux/sql-server-linux-configure-pmem.md)
31-
30+
* [Configure persistent memory (PMEM) for SQL Server on Windows](../configure-windows/configure-persistent-memory.md)(Beginning with SQL Server 2022).
31+
* [Configure persistent memory (PMEM) for SQL Server on Linux](../../linux/sql-server-linux-configure-pmem.md).
3232

3333
## Enable hybrid buffer pool
3434

@@ -40,7 +40,7 @@ The following example enables hybrid buffer pool for an instance of SQL Server:
4040
ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED HYBRID_BUFFER_POOL = ON;
4141
```
4242

43-
By default, hybrid buffer pool is disabled at the instance scope. Note 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 total PMEM capacity on the server.
43+
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.
4444

4545
The following example enables hybrid buffer pool for a specific database.
4646

@@ -83,6 +83,12 @@ The following example lists the databases and the database level setting for hyb
8383
SELECT name, is_memory_optimized_enabled FROM sys.databases;
8484
```
8585

86+
## Hybrid buffer pool with direct write
87+
88+
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.
89+
90+
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).
91+
8692
## Best Practices for hybrid buffer pool
8793

8894
- 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).
@@ -94,3 +100,7 @@ SELECT name, is_memory_optimized_enabled FROM sys.databases;
94100
- If the server scoped setting for hybrid buffer pool is disabled, the feature will not be used by any user database.
95101

96102
- 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.
103+
104+
- 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.
105+
106+
- 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.

docs/linux/sql-server-linux-configure-pmem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Configure persistent memory (PMEM)
2+
title: Configure persistent memory (PMEM) - Linux
33
description: Learn how to configure persistent memory (PMEM) for SQL Server on Linux, and how to create namespaces for PMEM devices
44
ms.custom: seo-lt-2019
55
author: briancarrig
Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
2-
description: "Add persisted log buffer to a database"
2+
description: "Explains how to add a persisted log buffer to a database in SQL Server 2019 and later. Provides Transact SQL examples."
33
title: "Add persisted log buffer to a database"
44
ms.custom: ""
55
ms.date: "10/30/2019"
66
ms.prod: sql
77
ms.prod_service: "database-engine"
8-
ms.reviewer: ""
98
ms.technology: configuration
109
ms.topic: conceptual
1110
helpviewer_keywords:
@@ -18,13 +17,13 @@ helpviewer_keywords:
1817
ms.assetid: 8ead516a-1334-4f40-84b2-509d0a8ffa45
1918
author: "briancarrig"
2019
ms.author: "brcarrig"
21-
manager: amitban
20+
ms.reviewer: mikeray
2221
---
2322

2423
# Add persisted log buffer to a database
2524
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
2625

27-
This topic describes how to add a persisted log buffer to a database in [!INCLUDE[sqlv15](../../includes/sssql19-md.md)] using [!INCLUDE[tsql](../../includes/tsql-md.md)].
26+
This topic describes how to add a persisted log buffer to a database in [!INCLUDE[sqlv15](../../includes/sssql19-md.md)] and above using [!INCLUDE[tsql](../../includes/tsql-md.md)].
2827

2928
## Permissions
3029

@@ -36,11 +35,11 @@ To configure a persistent memory device in [Linux](../../linux/sql-server-linux-
3635

3736
## Configure persistent memory device (Windows)
3837

39-
To configure a persistent memory device in [Windows](/windows-server/storage/storage-spaces/deploy-pmem/).
38+
To configure a persistent memory device in [Windows](../../database-engine/configure-windows/configure-persistent-memory.md).
4039

4140
## Add a persisted log buffer to a database
4241

43-
The following examples adds a persisted log buffer.
42+
The following example adds a persisted log buffer.
4443

4544
```sql
4645
ALTER DATABASE <MyDB>
@@ -52,33 +51,59 @@ ALTER DATABASE <MyDB>
5251
);
5352
```
5453

55-
Note that the log file on the DAX volume will be sized at 20MB regardless of the size specified wih the ADD FILE command.
54+
For example:
5655

57-
The volume or mount the new log file is placed must be formatted with DAX (NTFS) or mounted with the DAX option (XFS/EXT4).
56+
```sql
57+
ALTER DATABASE WideWorldImporters
58+
ADD LOG FILE
59+
(
60+
NAME = wwi_log2,
61+
FILENAME = 'F:/SQLTLog/wwi_log2.pldf',
62+
SIZE = 20MB
63+
);
64+
```
65+
66+
The log file on the DAX volume will be sized at 20 MB regardless of the size specified with the ADD FILE command.
67+
68+
The volume or mount the new log file is placed must be formatted with DAX enabled (NTFS) or mounted with the DAX option (XFS/EXT4).
5869

5970
## Remove a persisted log buffer
6071

6172
To safely remove a persisted log buffer, the database must be placed in single user mode in order to drain the persisted log buffer.
6273

63-
The following example places removes a persisted log buffer.
74+
The following example removes a persisted log buffer.
6475

6576
```sql
6677
ALTER DATABASE <MyDB> SET SINGLE_USER;
6778
ALTER DATABASE <MyDB> REMOVE FILE <DAXlog>;
6879
ALTER DATABASE <MyDB> SET MULTI_USER;
6980
```
81+
For example:
82+
83+
```sql
84+
ALTER DATABASE WideWorldImporters SET SINGLE_USER;
85+
ALTER DATABASE WideWorldImporters REMOVE FILE wwi_log2;
86+
ALTER DATABASE WideWorldImporters SET MULTI_USER;
87+
```
7088

7189
## Limitations
7290

7391
[Transparent Data Encryption (TDE)](../security/encryption/transparent-data-encryption.md) is not compatible with persisted log buffer.
7492

75-
[Availability Groups](../../t-sql/statements/create-availability-group-transact-sql.md) can only use this feature on secondary replicas due to need for normal log writing semantics on the primary. However, the small log file must be created on all nodes (ideally on DAX volumes or mounts).
93+
[Availability Groups](../../t-sql/statements/create-availability-group-transact-sql.md) can only use this feature on secondary replicas due to the requirement by the log reader agent for standard log writing semantics on the primary. However, the small log file must be created on all nodes (ideally on DAX volumes or mounts). In the event of a failover, the persisted log buffer path must exist, in order for the failover to be successful.
94+
95+
In cases where the path or file isn't present during an Availability Group failover event, or database startup, the database enters a `RECOVERY PENDING` state until the issue is resolved.
96+
97+
## Interoperability with other PMEM features
98+
99+
When both Persisted log buffer and [Hybrid Buffer Pool](../../database-engine/configure-windows/hybrid-buffer-pool.md) are jointly enabled, along with start-up [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md), Hybrid buffer pool will operate in what is known as _Direct Write_ mode.
76100

77-
## Backup and restore operations
101+
## Back up and restore operations
78102

79103
Normal restore conditions apply. If persisted log buffer is restored to a DAX volume or mount, it will continue to function, otherwise it can be safely removed.
80104

81105
## Next steps
82106

83-
- [How It Works (It Just Runs Faster): Non-Volatile Memory SQL Server Tail Of Log Caching on NVDIMM](/archive/blogs/bobsql/how-it-works-it-just-runs-faster-non-volatile-memory-sql-server-tail-of-log-caching-on-nvdimm)
84-
- [Transaction Commit latency acceleration using Storage Class Memory in Windows Server 2016/SQL Server 2016 SP1](/archive/blogs/sqlserverstorageengine/transaction-commit-latency-acceleration-using-storage-class-memory-in-windows-server-2016sql-server-2016-sp1)
107+
- [How It Works (It Just Runs Faster): Non-Volatile Memory SQL Server Tail Of Log Caching on NVDIMM](https://techcommunity.microsoft.com/t5/sql-server-blog/how-it-works-it-just-runs-faster-non-volatile-memory-sql-server/ba-p/3209699)
108+
- [Transaction Commit latency acceleration using Storage Class Memory in Windows Server 2016/SQL Server 2016 SP1](https://techcommunity.microsoft.com/t5/sql-server-blog/transaction-commit-latency-acceleration-using-storage-class/ba-p/384995)
109+
- [Hybrid Buffer Pool](../../database-engine/configure-windows/hybrid-buffer-pool.md)

0 commit comments

Comments
 (0)