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
Certain versions of supported Linux distributions provide support for FUA I/O subsystem capability, which provides data durability. [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] uses FUA capability to provide highly efficient and reliable I/O for [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] workloads. For more information on FUA support by Linux distribution and its effect on [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)], see [SQL Server On Linux: Forced Unit Access (FUA) Internals](https://techcommunity.microsoft.com/t5/sql-server-blog/sql-server-on-linux-forced-unit-access-fua-internals/ba-p/3199102).
10
+
11
+
SUSE Linux Enterprise Server 12 SP5, Red Hat Enterprise Linux 8.0, and Ubuntu 18.04 introduced support for FUA capability in the I/O subsystem. If you're using [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU 6 and later versions, you should use following configuration for high performing and efficient I/O implementation with FUA by [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)].
12
+
13
+
Use this recommended configuration if the following conditions are met.
14
+
15
+
- Using [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU 6 and later versions
16
+
- Using a Linux distribution and version that supports FUA capability (starting with Red Hat Enterprise Linux 8.0, SUSE Linux Enterprise Server 12 SP5, or Ubuntu 18.04)
17
+
- On storage subsystem and/or hardware that supports and is configured for FUA capability
18
+
19
+
Recommended configuration:
20
+
21
+
1. Enable Trace Flag 3979 as a startup parameter
22
+
1. Use **mssql-conf** to configure `control.writethrough = 1` and `control.alternatewritethrough = 0`
23
+
24
+
For almost all other configuration that doesn't meet the previous conditions, the recommended configuration is as follows:
25
+
26
+
1. Enable Trace Flag 3982 as a startup parameter (which is the default for [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] in the Linux ecosystem), and make sure that Trace Flag 3979 isn't enabled as a startup parameter
27
+
1. Use **mssql-conf** to configure `control.writethrough = 1` and `control.alternatewritethrough = 1`
# Configure persistent memory (PMEM) for SQL Server on Linux
14
15
15
16
[!INCLUDE [SQL Server - Linux](../includes/applies-to-version/sql-linux.md)]
16
17
17
-
This article describes how to configure the persistent memory (PMEM) for [!INCLUDE[sqlv15](../includes/sssql19-md.md)] on Linux.
18
+
This article describes how to configure the persistent memory (PMEM) for [!INCLUDE[sssql19-md](../includes/sssql19-md.md)] and later versions on Linux.
18
19
19
20
## Overview
20
21
21
-
[!INCLUDE[sqlv15](../includes/sssql19-md.md)]has many in-memory features that use persistent memory. This document covers the steps required to configure persistent memory for SQL Server on Linux.
22
+
[!INCLUDE[sssql19-md](../includes/sssql19-md.md)]introduced many in-memory features that use persistent memory. This article covers the steps required to configure persistent memory for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] on Linux.
22
23
23
-
> [!NOTE]
24
-
> The term _enlightenment_ was introduced to convey the concept of working with a persistent memory aware file system. Direct access to the file system from user-space applications is facilitated using memory mapping (`mmap()`). When a memory mapping for a file is created the application can issue load/store instructions bypassing the I/O stack completely. This is considered an "enlightened" file access method from the perspective of the host extension application (which is the black box code that allows SQLPAL interact with the Windows or Linux OS).
24
+
> [!NOTE]
25
+
> The term _enlightenment_ was introduced to convey the concept of working with a persistent memory aware file system. Direct access to the file system from user-space applications is facilitated using memory mapping (`mmap()`). When a memory mapping for a file is created the application can issue load/store instructions bypassing the I/O stack completely. This is considered an "enlightened" file access method from the perspective of the host extension application (which is the code that allows SQLPAL interact with the Windows or Linux OS).
25
26
26
27
## Create namespaces for PMEM devices
27
28
@@ -30,16 +31,16 @@ This article describes how to configure the persistent memory (PMEM) for [!INCLU
30
31
In Linux, use the `ndctl` utility.
31
32
32
33
- Install `ndctl` to configure PMEM device. You can find it [here](https://docs.pmem.io/getting-started-guide/installing-ndctl).
33
-
- Use `ndctl` to create a namespace. Namespaces are interleaved across PMEM NVDIMMs and can provide different types of user-space access to memory regions on the device. `fsdax` is default and desired mode for SQL Server.
34
+
- Use `ndctl` to create a namespace. Namespaces are interleaved across PMEM NVDIMMs and can provide different types of user-space access to memory regions on the device. `fsdax` is default and desired mode for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)].
We have chosen `fsdax` mode and are using system memory to store per-page metadata. We recommend using `--map=dev`. This stores the meta data on the namespace directly. Storing meta data in memory using `--map=mem` is considered experimental at this time.
40
+
We have chosen `fsdax` mode and are using system memory to store per-page metadata. We recommend using `--map=dev`. This option stores the meta data on the namespace directly. Storing meta data in memory using `--map=mem` is experimental at this time.
41
+
42
+
Use `ndctl` to verify the namespace.
40
43
41
-
Use `ndctl` to verify the namespace.
42
-
43
44
Sample output follows:
44
45
45
46
```bash
@@ -74,33 +75,48 @@ mount -o dax,noatime /dev/pmem0 /mnt/dax
74
75
75
76
## Technical considerations
76
77
77
-
- Block allocation of 2 MB for either XFS/EXT4, as described above
78
+
- Block allocation of 2 MB for either XFS/EXT4, as described previously
78
79
- Misalignment between block allocation and `mmap` results in silent fallback to 4 KB
79
80
- File sizes should be a multiple of 2 MB (modulo 2 MB)
80
-
-Do not disable transparent huge pages (THP) (enabled by default on most distros)
81
+
-Don't disable transparent huge pages (THP) (enabled by default on most distributions)
81
82
82
-
Once the device has been configured with `ndctl`, created, and mounted, you can place database files in it or create a new database.
83
+
Once the device is configured with `ndctl`, created, and mounted, you can place database files in it or create a new database.
83
84
84
-
You can store the SQL Server data files (MDFS, NDFS) and tempdb files on a PMEM device when configured with the mode `fsdax` using the command below. This shouldn't be used to store the SQL Server log (LDFS) files, as transaction log needs to be on storage that provides sector atomic guarantees:
85
+
You can store the [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] data files (MDFS, NDFS) and `tempdb` files on a PMEM device when configured with the mode `fsdax` using the following command. Don't use this to store the [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] log (LDFS) files, as transaction log needs to be on storage that provides sector atomic guarantees:
Before you set the map option in the preceding command, keep the following points in mind:
91
92
92
-
- For best performance at accessing and updating these NVDIMM page entries for this device, it's preferable to use `-map=mem`
93
+
- For best performance at accessing and updating these NVDIMM page entries for this device, it's preferable to use `-map=mem`
93
94
- If the capacity of the NVDIMM is too large (greater than 512 GB), set the `–map=dev`, which would impact the IO throughput and stymie the performance
94
95
95
-
For SQL Server log files on PMEM devices, provision the PMEM device(s) to use sector/Block Translation Table (BTT). This provides the needed sector atomicity for SQL Server logs files for this technology of storage devices. We also recommend that you perform workload performance validations and compare the SQL Server log performance for your workload between this solution and best-in-class NVMe SSDs, and then select the solution that best meets your needs and provides better performance.
96
+
For [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] log files on PMEM devices, con the PMEM device(s) to use sector/Block Translation Table (BTT). This provides the needed sector atomicity for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] logs files for this technology of storage devices. We also recommend that you perform workload performance validations. You can compare the [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] log performance for your workload between this solution and best-in-class NVMe SSDs, and then select the solution that best meets your needs and provides better performance.
Because PMEM devices are O_DIRECT (direct I/O) safe, consider enabling trace flag 3979 to disable the forced flush mechanism. For more information, see [FUA support](https://support.microsoft.com/help/4131496/enable-forced-flush-mechanism-in-sql-server-2017-on-linux). Forced unit access internals are covered here [FUA internals](/archive/blogs/bobsql/sql-server-on-linux-forced-unit-access-fua-internals).
102
+
### Disable forced flush behavior
103
+
104
+
Because PMEM devices are `O_DIRECT` (direct I/O) safe, you can [disable the forced flush behavior](#sql-server-and-forced-unit-access-fua-io-subsystem-capability).
105
+
106
+
> [!NOTE]
107
+
> A storage system can make sure that any cached or staged writes are considered safe and durable, by guaranteeing that writes issued to the device are kept on a medium that will persist across system crashes, interface resets and power failures, and the medium itself is hardware redundant.
108
+
109
+
- Database (`.mdf` and `.ndf`) and transaction log (`.ldf`) files don't use `writethrough` and `alternatewritethrough` by default in [!INCLUDE [sssql17-md](../includes/sssql17-md.md)] CU 6 and later versions, because they use the forced flush behavior. Trace Flag 3979 disables the use of the forced flush behavior for database and transaction log files, and uses the `writethrough` and `alternatewritethrough` logic.
110
+
111
+
- Other files that are opened by using `FILE_FLAG_WRITE_THROUGH` in [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)], such as database snapshots, internal snapshots for database consistency checks (`DBCC CHECKDB`), profiler trace files, and extended event trace files, use the `writethrough` and `alternatewritethrough` optimizations.
112
+
113
+
For more information about the changes introduced in [!INCLUDE [sssql17-md](../includes/sssql17-md.md)] CU 6, see [KB 4131496](https://support.microsoft.com/help/4131496). For more information about forced unit access (FUA) internals, see [FUA internals](/archive/blogs/bobsql/sql-server-on-linux-forced-unit-access-fua-internals).
114
+
115
+
#### SQL Server and Forced Unit Access (FUA) I/O subsystem capability
0 commit comments