|
1 | 1 | --- |
2 | | -title: Fix heavy memory usage in ReFS |
3 | | -description: Discusses memory pressure and performance issues that occur in the Resilient File System (ReFS) in Windows. Provides a resolution and workarounds. |
4 | | -ms.date: 02/12/2026 |
| 2 | +title: Tuning memory usage in ReFS |
| 3 | +description: Discusses how to apply a cumulative update and configure registry entries to reduce ReFS memory usage. |
| 4 | +ms.date: 06/05/2026 |
5 | 5 | manager: dcscontentpm |
6 | 6 | audience: itpro |
7 | 7 | ms.topic: troubleshooting |
8 | | -ms.reviewer: kaushika |
| 8 | +ms.reviewer: kaushika, v-appelgatet |
9 | 9 | ms.custom: |
10 | | -- sap:backup,recovery,disk,and storage\partition and volume management |
| 10 | +- sap:backup, recovery, disk, and storage\refs |
11 | 11 | - pcy:WinComm Storage High Avail |
12 | 12 | appliesto: |
13 | 13 | - <a href=https://learn.microsoft.com/windows/release-health/windows-server-release-info target=_blank>Supported versions of Windows Server</a> |
14 | 14 | --- |
15 | | -# FIX: Heavy memory usage in ReFS on Windows |
| 15 | +# Tuning memory usage in ReFS |
16 | 16 |
|
17 | | -This article provides a solution to memory pressure and performance issues that occur in the Resilient File System (ReFS) in Windows. |
18 | | - |
19 | | -_Applies to:_ Windows 10 - all editions, Windows Server 2016, Windows Server 2019 |
20 | 17 | _Original KB number:_ 4016173 |
21 | 18 |
|
| 19 | +## Summary |
| 20 | + |
| 21 | +Resilient File System (ReFS) can consume large amounts of memory because of its allocate-on-write metadata semantics and block caching logic. This behavior can cause memory pressure that degrades server performance. |
| 22 | + |
| 23 | +This article describes the cause of the issue and explains how to apply a cumulative update and configure registry entries to reduce ReFS memory usage. |
| 24 | + |
22 | 25 | ## Symptoms |
23 | 26 |
|
24 | | -You notice heavy memory usage on a computer that's running Windows 10, Windows Server 2016, Windows Server 2019, Windows Server, 1903 or Windows Server, version 1909. |
| 27 | +You notice heavy memory usage on a computer that uses the Resilient File System (ReFS). |
25 | 28 |
|
26 | 29 | ## Cause |
27 | 30 |
|
28 | | -To provide greater resiliency for its metadata, the Resilient File System (ReFS) in Windows Server 2016 uses allocate-on-write semantics for all metadata updates. Which means that ReFS never makes in-place updates to metadata. Instead, it makes all writes to newly allocated regions. |
| 31 | +To provide greater resiliency for its metadata, ReFS uses *allocate-on-write* semantics for all metadata updates. This approach means that ReFS never makes in-place updates to metadata. Instead, it makes all writes to newly allocated regions. |
29 | 32 |
|
30 | | -However, allocating-on-write causes ReFS to issue more metadata I/O to new regions of the volume than write-in-place file systems do. Additionally, ReFS uses block caching logic to cache its metadata in RAM. It isn't as resource-efficient as file caching logic. |
| 33 | +However, using allocate-on-write causes ReFS to issue more metadata I/O to new regions of the volume than write-in-place file systems do. Additionally, ReFS uses block caching logic to cache its metadata in RAM. It isn't as resource efficient as file caching logic. |
31 | 34 |
|
32 | | -Together, the ReFS block caching logic and allocate-on-write semantics cause ReFS metadata streams to be large. ReFS uses the cache manager to create the metadata streams, and the cache manager lazily unmaps inactive views. In some situations, this lazy unmapping causes the active working set on the server to grow. This creates memory pressure that can cause poor performance. |
| 35 | +Because of the ReFS block caching logic and allocate-on-write semantics, ReFS uses large metadata streams. ReFS uses the cache manager to create the metadata streams, and the cache manager unmaps inactive views in a lazy manner. In some situations, this lazy unmapping causes the active working set on the server to grow. This growth creates memory pressure that can, in turn, cause poor performance. |
33 | 36 |
|
34 | 37 | ## Resolution |
35 | 38 |
|
36 | | -This issue is addressed in cumulative update 4013429 that was released on March 14, 2017. The update introduces three tunable registry parameters. |
| 39 | +Cumulative update (CU) 4013429 that was released on March 14, 2017 introduced three tunable registry entries that you can use to adjust large ReFS metadata streams. |
37 | 40 |
|
38 | | -Cumulative update 4013429 is available through Windows Update. You can also download it directly through the [Microsoft Update Catalog](https://www.catalog.update.microsoft.com/Search.aspx?q=4013429). |
| 41 | +### How to set the tunable registry entries |
39 | 42 |
|
40 | | -For more information, see [March 14, 2017—KB4013429 (OS Build 14393.953)](https://support.microsoft.com/help/4013429/) |
| 43 | +[!INCLUDE [Registry important alert](../../../includes/registry-important-alert.md)] |
41 | 44 |
|
42 | | -## How to set the tunable parameters |
| 45 | +You can use Registry Editor or command-line commands (such as `reg add`) to set the registry entries. The scopes of these parameters don't overlap, so you can use them in any combination. The registry entries are all under the `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem` subkey. |
43 | 46 |
|
44 | | -This update provides three tunable registry parameters to address large ReFS metadata streams. You can use the following optional methods to set the parameters. These parameters can be used in any combination because they don't overlap functionally. |
| 47 | +| Value name | Type | Default value | Effects | |
| 48 | +| --- | --- | --- | --- | |
| 49 | +| `RefsEnableLargeWorkingSetTrim` | REG_DWORD | | When set to 1, ReFS tries to a complete an MM unmap of all metadata streams at every checkpoint. | |
| 50 | +| `RefsNumberOfChunksToTrim` | REG_DWORD | 4 | Affects the granularity at which ReFS unmaps when it cycles the entire namespace. Setting `RefsNumberOfChunksToTrim` to higher values causes ReFS to trim more aggressively. It reduces the amount of memory that's being used. | |
| 51 | +| `RefsEnableInlineTrim` | REG_DWORD | | | |
45 | 52 |
|
46 | | -> [!IMPORTANT] |
| 53 | +> [!IMPORTANT] |
47 | 54 | > |
48 | | -> - A restart is required for these parameter changes to take effect. |
49 | | -> - These parameters must be set consistently on every node of a failover cluster. |
50 | | -
|
51 | | -## Option 1 |
52 | | - |
53 | | -This option causes ReFS to try a complete an MM unmap of all metadata streams at every checkpoint. This option will produce the expected result only if the volume is idle and doesn't have any mapped pages. |
54 | | - |
55 | | -Specify the indicated values in the following subkey: |
56 | | - |
57 | | -`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem` |
58 | | -Value Name: **RefsEnableLargeWorkingSetTrim** |
59 | | -Set RefsEnableLargeWorkingSetTrim = **1** |
60 | | -Value Type: **REG_DWORD** |
61 | | - |
62 | | -## Option 2 |
63 | | - |
64 | | -ReFS has a lazy MM unmap logic. So when ReFS cycles the entire namespace to complete an MM unmap, it unmaps at a certain granularity. The amount of virtual address space that is unmapped is determined by the following formula: |
| 55 | +> - After you change these parameters, you have to restart the computer. |
| 56 | +> - On a failover cluster, you have to set these parameters in the same manner on every cluster node. |
65 | 57 |
|
66 | | -RefsNumberOfChunksToTrim *128 MB (for volume of size > 10 TB) |
67 | | -RefsNumberOfChunksToTrim* 64 MB (for volume of size < 10 TB) |
| 58 | +If you see poor performance because of a large active working set, follow these steps to tune ReFS behavior: |
68 | 59 |
|
69 | | -This option works if the VA range that's being unmapped doesn't have any active references (that is, mapped metadata pages). |
| 60 | +1. Verify that the volume is idle and doesn't have any mapped pages. Then, set `RefsEnableLargeWorkingSetTrim` to `1`, and monitor the system to see whether performance improves. |
70 | 61 |
|
71 | | -Specify the indicated values in the following subkey: |
| 62 | +1. If performance doesn't improve sufficiently, verify that the VA range that's being unmapped doesn't have any active references (that is, mapped metadata pages). |
72 | 63 |
|
73 | | -`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem` |
74 | | -Value Name: **RefsNumberOfChunksToTrim** |
75 | | -Value Type: **REG_DWORD** |
76 | | -DEFAULT (if not set or 0): **4** |
| 64 | +1. Change the value of `RefsNumberOfChunksToTrim`. Try different values, such as `8`, `16`, `32`, and so forth. |
77 | 65 |
|
78 | | -> [!NOTE] |
79 | | -> Setting **RefsNumberOfChunksToTrim** to higher values causes ReFS to trim more aggressively. It reduces the amount of memory that's being used. Set the trim value to an appropriate number: 8, 16, 32, and so on. |
| 66 | + > [!NOTE] |
| 67 | + > The following formulas determine the granularity at which ReFS unmaps virtual address space: |
| 68 | + > |
| 69 | + > - `RefsNumberOfChunksToTrim` \* 128 MB (for volume of size > 10 TB) |
| 70 | + > - `RefsNumberOfChunksToTrim` \* 64 MB (for volume of size < 10 TB) |
80 | 71 |
|
81 | | -## Option 3 |
82 | | - |
83 | | -In this option, ReFS sends down an MM trim inline while it unmaps its metadata page. This is the most aggressive option because it can cause performance regression if ReFS is used on high-performance media, such as an SSD or NVMe. |
84 | | - |
85 | | -Specify the indicated values in the following subkey: |
86 | | - |
87 | | -`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem` |
88 | | -Value Name: **RefsEnableInlineTrim** |
89 | | -Value Type: **REG_DWORD** |
90 | | -Set **RefsEnableInlineTrim = 1** |
91 | | - |
92 | | -**Recommendation:** |
93 | | - |
94 | | -If a large active working set causes poor performance, first try to set **RefsEnableLargeWorkingSetTrim = 1**. |
95 | | - |
96 | | -If this setting doesn't produce a satisfactory result, try different values for **RefsNumberOfChunksToTrim**, such as 8, 16, 32, and so on. |
97 | | - |
98 | | -If this still doesn't provide the wanted effect, set **RefsEnableInlineTrim = 1**. |
| 72 | +1. If performance still doesn't improve, set `RefsEnableInlineTrim` to `1`. |
99 | 73 |
|
100 | 74 | ## More information |
101 | 75 |
|
102 | | -To update its metadata, ReFS uses allocate-on-write instead of writing-in-place to improve its resiliency to corruption. |
103 | | - |
104 | | -Writing-in-place is susceptible to torn writes. It occurs if a power failure or an unexpected dismount causes a write to be only partially completed. |
105 | | - |
106 | | -Allocating-on-write enables ReFS to reliably maintain metadata consistency after a power failure or an unexpected dismount. It's because ReFS can still reference the previous, consistent metadata copy. |
| 76 | +To improve its resiliency to corruption, ReFS uses allocate-on-write instead of write-in-place to update its metadata. A power failure or an unexpected dismount can cause "torn writes" (writes that are only partially completed) in a system that uses write-in-place. However, under the same circumstances, a system that uses allocate-on-write can still reference the previous, consistent metadata copy. In this manner, ReFS reliably maintains metadata consistency. |
107 | 77 |
|
108 | 78 | ## References |
109 | 79 |
|
|
0 commit comments