鏡像加速的同位Mirror-accelerated parity

適用於:Windows Server 2016Applies to: Windows Server 2016

儲存空間可以使用兩個基本技術提供資料容錯:鏡像和同位。Storage Spaces can provide fault tolerance for data using two fundamental techniques: mirror and parity. 儲存空間直接存取中,ReFS 引入鏡像加速同位,可讓您建立同時使用鏡像和同位復原的磁碟區。In Storage Spaces Direct, ReFS introduces mirror-accelerated parity, which enables you to create volumes that use both mirror and parity resiliencies. 鏡像加速的同位提供便宜、節省空間的儲存空間,同時不犧牲效能。Mirror-accelerated parity offers inexpensive, space-efficient storage without sacrificing performance.

鏡像加速的同位磁碟區

背景Background

鏡像和同位復原配置有徹底不同的儲存空間及效能特性:Mirror and parity resiliency schemes have fundamentally different storage and performance characteristics:

  • 鏡像復原可讓使用者獲得快速寫入效能,但複寫每個複本的資料很佔用空間。Mirror resiliency allows users to attain fast write performance, but replicating the data for each copy isn’t space efficient.
  • 另一方面,同位必須重新計算每個寫入的同位,造成隨機寫入效能不佳。Parity, on the other hand, must re-compute parity for every write, causing random write performance to suffer. 不過,同位確實可讓使用者有更多空間來儲存資料。Parity does, however, allow users to store their data with greater space efficiency. (到(Read more about space efficiency 此處深入了解空間效率).).

因此,鏡像傾向於提供要求效能的儲存空間,而同位可改善儲存空間容量的使用率。Thus, mirror is predisposed to deliver performance-sensitive storage while parity offers improved storage capacity utilization. 在鏡像加速的同位中,ReFS 運用兩個復原類型的優勢,透過將兩個復原配置同時結合至單一磁碟區中,來同時提供容量有效率以及重視效能的儲存空間。In mirror-accelerated parity, ReFS leverages the benefits of each resiliency type to deliver both capacity-efficient and performance-sensitive storage by combining both resiliency schemes within a single volume.

鏡像加速同位上的資料循環Data rotation on mirror-accelerated parity

ReFS 會即時在鏡像和同位之間主動循環資料。ReFS actively rotates data between mirror and parity, in real-time. 這可讓連入寫入快速寫入至鏡像,接著循環至同位以有效率地儲存。This allows incoming writes to be quickly written to mirror then rotated to parity to be stored efficiently. 如此一來,連入 IO 可在鏡像中獲得快速服務,而非經常存取的資料可有效率地儲存在同位中,在相同的磁碟區同時提供最佳效能和低成本的儲存空間。In doing so, incoming IO is serviced quickly in mirror while cold data is stored efficiently in parity, delivering both optimal performance and lost-cost storage within the same volume.

為了在鏡像和同位之間循環資料,ReFS 在邏輯上將磁碟區分為 64 MiB 的區域 (這是循環的單位)。To rotate data between mirror and parity, ReFS logically divides the volume into regions of 64 MiB, which are the unit of rotation. 下列影像描述區分為區域的鏡像加速同位磁碟區。The image below depicts a mirror-accelerated parity volume divided into regions.

鏡像加速同位磁碟區與儲存體容器

當鏡像層已達指定的容量層級,ReFS 會開始從鏡像到同位循環完整區域。ReFS begins rotating full regions from mirror to parity once the mirror tier has reached a specified capacity level. ReFS 不會立即將資料從鏡像移動到同位,而是盡可能等待並將資料保留在鏡像,讓 ReFS 可以繼續提供資料的最佳效能 (請參閱下方的<IO 效能>)。Instead of immediately moving data from mirror to parity, ReFS waits and retains data in mirror as long as possible, allowing ReFS to continue delivering optimal performance for the data (see “IO performance” below).

當資料從鏡像移至同位時,系統會讀取資料、計算同位編碼,接著將資料寫入同位。When data is moved from mirror to parity, the data is read, parity encodings are computed, and then that data is written to parity. 下方動畫使用三向鏡像區域來說明這個程序,在循環期間會轉換為清除編碼區域:The animation below illustrates this using a three-way mirrored region that is converted into an erasure coded region during rotation:

鏡像加速同位循環

鏡像加速同位上的 IOIO on mirror-accelerated parity

IO 行為IO behavior

寫入:ReFS 以三種不同方式服務連入寫入:Writes: ReFS services incoming writes in three distinct ways:

  1. 寫入鏡像:Writes to Mirror:
    • a.a. 如果連入寫入修改鏡像上的現有資料,ReFS 會就地修改資料。If the incoming write modifies existing data in mirror, ReFS will modify the data in place.
    • b.b. 如果連入寫入是新的寫入,且 ReFS 可以在鏡像中成功找到服務這個寫入的足夠空間,則 ReFS 將會寫入鏡像。If the incoming write is a new write, and ReFS can successfully find enough free space in mirror to service this write, ReFS will write to mirror.

寫入鏡像

  1. 寫入鏡像,從同位重新配置:Writes to Mirror, Reallocated from Parity:
    • a.a. 如果連入寫入修改同位中的資料,且 ReFS 可以在鏡像中成功找到服務這個連入寫入的足夠空間,則 ReFS 會先讓同位中的舊資料失效,然後再寫入鏡像。If the incoming write modifies data that’s in parity, and ReFS can successfully find enough free space in mirror to service the incoming write, ReFS will first invalidate the previous data in parity and then write to mirror. 這個失效動作是快速又便宜的中繼資料操作,可協助有意義地改善對同位的寫入效能。This invalidation is a quick and inexpensive metadata operation that helps meaningfully improve write performance made to parity.

重新配置寫入

  1. 寫入同位:Writes to Parity:
    • a.a. 如果 ReFS 無法在鏡像中成功找到足夠空間,則 ReFS 會將新資料寫入同位,或直接在同位中修改現有資料。If ReFS cannot successfully find enough free space in mirror, ReFS will write new data to parity or modify existing data in parity directly. 下方的<效能最佳化>章節提供協助將寫入同位最小化的指導方針。The “Performance optimizations” section below provides guidance that helps minimize writes to parity.

寫入同位

讀取:ReFS 會直接從包含相關資料的層讀取。Reads: ReFS will read directly from the tier containing the relevant data. 如果同位是以 HDD 建構,則「儲存空間直接存取」中的快取會快取此資料來加快未來的讀取。If parity is constructed with HDDs, the cache in Storage Spaces Direct will cache this data to accelerate future reads.

注意

讀取不會導致 ReFS 將資料循環回鏡像層。Reads never cause ReFS to rotate data back into the mirror tier.

IO 效能:IO performance:

寫入:上述每一種寫入都有它自己的效能特性。Writes: Each type of write described above has its own performance characteristics. 大致而言,寫入鏡像層會比重新配置寫入更快,而重新配置寫入又會比直接寫入同位層快得多。Roughly speaking, writes to the mirror tier are much faster than reallocated writes, and reallocated writes are significantly faster than writes made directly to the parity tier. 我們以下方的不等式來說明這種關係:This relationship is illustrated by the inequality below:

  • 寫入鏡像 > 重新配置寫入 >> 同位層Mirror Tier > Reallocated Writes >> Parity Tier

讀取:從同位讀取時,不會產生有意義的負面效能影響:Reads: There is no meaningful, negative performance impact when reading from parity:

  • 如果鏡像和同位以相同的媒體類型建構,則讀取效能相等。If mirror and parity are constructed with the same media type, read performance will be equivalent.
  • 如果鏡像和同位以不同的媒體類型建構 — 例如鏡像 SSD、同位 HDD — 則儲存空間直接存取中的快取可協助快取經常存取的資料,來加速從同位的任何讀取。If mirror and parity are constructed with different media types—Mirrored SSDs, Parity HDDs, for example—the cache in Storage Spaces Direct will help cache hot data to accelerate any reads from parity.

ReFS 壓縮ReFS compaction

在今年秋季的半年度發行中,ReFS 引進壓縮,可大幅改善 90+% 滿的鏡像加速同位磁碟區的效能。In this Fall’s semi-annual release, ReFS introduces compaction, which substantially improves performance for mirror-accelerated parity volumes that are 90+% full.

背景:以前,在鏡像加速同位磁碟區快滿時,這些磁碟區的效能會降低。Background: Previously, as mirror-accelerated parity volumes became full, the performance of these volumes could degrade. 效能降低是因為經常存取和非經常存取的資料隨著時間而在整個磁碟區中混在一起。The performance degrades because hot and cold data become mixed throughout the volume overtime. 這表示由於非經常存取的資料佔用原本可供經常存取的資料使用的鏡像空間,因此較不經常存取的資料儲存在鏡像中。This means less hot data can be stored in mirror since cold data occupies space in mirror that could otherwise be used by hot data. 將經常存取的資料儲存在鏡像對於維護高效能來說很重要,因為直接寫入鏡像會比重新配置寫入來得快,而數量級又比直接寫入同位更快。Storing hot data in mirror is critical to maintaining high performance because writes directly to mirror are much faster than reallocated writes and orders of magnitude faster than writes directly to parity. 因此,鏡像中有非經常存取的資料對效能來說是不好的,因為它會降低 ReFS 可以直接寫入鏡像的可能性。Thus, having cold data in mirror is bad for performance, as it reduces the likelihood that ReFS can make writes directly to mirror.

ReFS 壓縮透過釋放鏡像中的空間來供經常存取的資料使用,解決這些效能問題。ReFS compaction addresses these performance issues by freeing up space in mirror for hot data. 壓縮會先將鏡像和同位中的所有資料合併到同位中。Compaction first consolidates all data—from both mirror and parity—into parity. 這樣可以減少磁碟區中的分散程度,提高鏡像中的可定位空間量。This reduces fragmentation within the volume and increases the amount of addressable space in mirror. 更重要的是,此程序可讓 ReFS 將經常存取的資料合併回鏡像:More importantly, this process enables ReFS to consolidate hot data back into mirror:

  • 有新寫入傳入時,它們會在鏡像中服務。When new writes come in, they will be serviced in mirror. 因此,新寫入、經常存取的資料會保留在鏡像中。Thus, newly written, hot data resides in mirror.
  • 對同位中的資料有修改寫入時,ReFS 會進行重新配置寫入,因此也可以在鏡像中服務這個寫入。When a modifying write is made to data in parity, ReFS makes a reallocated write, so this write is serviced in mirror as well. 如此一來,在壓縮期間移至同位的經常存取的資料將會重新配置回到鏡像。Consequently, hot data that was moved into parity during compaction will be reallocated back into mirror.

效能最佳化Performance optimizations

重要

對於鏡像加速同位中的 Hyper-V 工作負載,當大量寫入 VHD 分散到多個目錄時 ReFS 可提供最佳效能。For Hyper-V workloads on mirror-accelerated parity, ReFS delivers the best performance when write-heavy VHDs are distributed across multiple directories. 因此,若要達到最佳效能,建議不將要許多大量寫入的 VHD 放在同一個子目錄中。Thus, to achieve optimal performance, it is recommended to not place many, write-heavy VHDs in the same subdirectory.

效能計數器:Performance counters:

ReFS 維護效能計數器,協助評估鏡像加速同位的效能。ReFS maintains performance counters to help evaluate the performance of mirror-accelerated parity.

  • 如上方〈寫入同位〉章節所述,ReFS 在鏡像中找不到可用空間時,會直接寫入同位。As described above in the Write to Parity section, ReFS will write directly to parity when it can’t find free space in mirror. 一般而言,當鏡像層的填滿速度比 ReFS 將資料循環至同位更快時,就會發生這種情形。Generally, this occurs when the mirrored tier fills up faster than ReFS can rotate data to parity. 換句話說,ReFS 循環跟不上擷取率。In other words, ReFS rotation is not able to keep up with the ingestion rate. 下方的效能計數器可識別 ReFS 直接寫入同位的時機:The performance counters below identify when ReFS writes directly to parity: ReFS\Data allocations slow tier/sec ReFS\Metadata allocations slow tier/sec
  • 如果這些計數器不是零,表示 ReFS 將資料循環出鏡像的速度不夠快。If these counters are non-zero, this indicates ReFS is not rotating data fast enough out of mirror. 若要協助改善此點,您可以變更循環積極程度或提高鏡像層的大小。To help alleviate this, one can either change the rotation aggressiveness or increase the size of the mirrored tier.

循環積極程度:Rotation aggressiveness:

ReFS 在鏡像到達指定的容量閾值時開始循環資料。ReFS begins rotating data once mirror has reached a specified capacity threshold.

  • 提高此循環閾值,會使得 ReFS 將資料留在鏡像層中更久。Higher values of this rotation threshold cause ReFS to retain data in the mirror tier longer. 將經常存取的資料保留在鏡像層中對效能來說最理想,但 ReFS 就無法有效地服務大量連入 IO。Leaving hot data in the mirror tier is optimal for performance, but ReFS will not be able to effectively service large amounts of incoming IO.
  • 降低此值可讓 ReFS 主動移出資料並改善擷取連入 IO。Lower values enable ReFS to proactively destage data and better ingest incoming IO. 這適用於大量擷取的工作負載,例如封存儲存空間。This is applicable to ingest-heavy workloads, such as archival storage. 不過,降低值可能會降低一般用途工作負載的效能。Lower values, however, could degrade performance for general purpose workloads. 非必要的將資料循環出鏡像層會降低效能。Unnecessarily rotating data out of the mirror tier carries a performance penalty.

ReFS 引進了可微調參數來調整這個閾值,可使用登錄機碼來設定此參數。ReFS introduces a tunable parameter to adjust this threshold, which is configurable using a registry key. 必須在儲存空間直接存取部署的每個節點上設定此登錄機碼,並需要重新開機,讓變更生效。This registry key must be configured on each node in a Storage Spaces Direct deployment, and a restart is required for any changes to take effect.

  • 機碼:HKEY_LOCAL_MACHINE\System\CurrentControlSet\PoliciesKey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Policies
  • ValueName (DWORD):DataDestageSsdFillRatioThresholdValueName (DWORD): DataDestageSsdFillRatioThreshold
  • ValueType:PercentageValueType: Percentage

若未設定此登錄機碼,ReFS 會使用預設值 85%。If this registry key is not set, ReFS will use a default value of 85%. 針對大部分部署,建議使用此預設值,並不建議使用低於 50% 的值。This default value is recommended for most deployments, and values below 50% are not recommended. 以下的 PowerShell 指令示範如何以 75% 的值來設定此登錄機碼:The PowerShell command below demonstrates how to set this registry key with a value of 75%:

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Policies -Name DataDestageSsdFillRatioThreshold -Value 75

若要在儲存空間直接存取部署中的每個節點上設定此登錄機碼,您可以使用下面的 PowerShell 命令:To configure this registry key across each node in a Storage Spaces Direct deployment, you can use the PowerShell command below:

$Nodes = 'S2D-01', 'S2D-02', 'S2D-03', 'S2D-04'
Invoke-Command $Nodes {Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Policies -Name DataDestageSsdFillRatioThreshold -Value 75}

增加鏡像層的大小:Increasing the size of the mirrored tier:

增加鏡像層的大小,可讓 ReFS 在鏡像中保留工作集的較大部分。Increasing the size of the mirrored tier enables ReFS to retain a larger portion of the working set in mirror. 這可改善 ReFS 直接寫入鏡像的可能性,協助獲得更好的效能。This improves the likelihood that ReFS can write directly to mirror, which will help achieve better performance. 以下的 PowerShell Cmdlet 示範如何增加鏡像層的大小:The PowerShell cmdlets below demonstrate how to increase the size of the mirrored tier:

Resize-StorageTier -FriendlyName “Performance” -Size 20GB
Resize-StorageTier -InputObject (Get-StorageTier -FriendlyName “Performance”) -Size 20GB

提示

務必在調整 StorageTier 的大小之後調整 PartitionVolume 的大小。Make sure to resize the Partition and Volume after you resize the StorageTier. 如需詳細資訊及範例,請參閱 Resize-VolumesFor more information and examples, see Resize-Volumes.

建立鏡像加速的同位磁碟區Creating a mirror-accelerated parity volume

以下的 PowerShell Cmdlet 使用鏡像:同位比 20:80 來建立鏡像加速的同位磁碟區,這是適用於大部分工作負載的建議設定。The PowerShell cmdlet below creates a mirror-accelerated parity volume with a Mirror:Parity ratio of 20:80, which is the recommended configuration for most workloads. 如需詳細資訊與範例,請參閱建立儲存空間直接存取中的磁碟區For more information and examples, see Creating volumes in Storage Spaces Direct.

New-Volume – FriendlyName “TestVolume” -FileSystem CSVFS_ReFS -StoragePoolFriendlyName “StoragePoolName” -StorageTierFriendlyNames Performance, Capacity -StorageTierSizes 200GB, 800GB

請參閱See also