了解快取中儲存空間直接存取Understanding the cache in Storage Spaces Direct

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

儲存空間直接存取功能建伺服器端快取來最大化儲存效能。Storage Spaces Direct features a built-in server-side cache to maximize storage performance. 這是大型、持續即時讀取寫入快取。It is a large, persistent, real-time read and write cache. 支援儲存空間直接存取時,會自動設定快取。The cache is configured automatically when Storage Spaces Direct is enabled. 在大部分案例中,不手動管理不需要。In most cases, no manual management whatsoever is required. 快取的運作方式而定出現的磁碟機的類型。How the cache works depends on the types of drives present.

下列視訊進入詳細資料快取如何運作的儲存空間直接存取,以及其他設計考量。The following video goes into details on how caching works for Storage Spaces Direct, as well as other design considerations.

儲存空間直接存取設計注意事項Storage Spaces Direct design considerations
(20 分鐘)(20 minutes)

磁碟機類型及部署選項Drive types and deployment options

儲存空間直接存取目前適用於三種類型的存放裝置:Storage Spaces Direct currently works with three types of storage devices:

NVMe(靜態記憶體快速)NVMe (Non-Volatile Memory Express)
SATA 日 SAS SSD(固態硬碟)SATA/SAS SSD (Solid-State Drive)
HDD(硬碟)HDD (Hard Disk Drive)

這些可結合六個的方式,我們分類兩個群組:「flash 所有」和「混合」。These can be combined in six ways, which we group into two categories: "all-flash" and "hybrid".

所有-flash 部署可能性All-flash deployment possibilities

所有 flash 部署目的放到最大效能儲存空間,請勿包含旋轉硬碟磁碟機 (HDD)。All-flash deployments aim to maximize storage performance and do not include rotational hard disk drives (HDD).

所有 Flash 部署-可能性

混合部署可能性Hybrid deployment possibilities

混合部署可以平衡效能與容量或放到最大容量的同時,包含旋轉硬碟磁碟機 (HDD)。Hybrid deployments aim to balance performance and capacity or to maximize capacity and do include rotational hard disk drives (HDD).


快取的磁碟機將會自動選取Cache drives are selected automatically

部署使用多種類型的磁碟機,在 [儲存空間直接存取自動使用「快速」類型的所有磁碟機快取。In deployments with multiple types of drives, Storage Spaces Direct automatically uses all drives of the "fastest" type for caching. 剩餘的磁碟機用於容量。The remaining drives are used for capacity.

判斷類型是「快速」是根據下列階層。Which type is "fastest" is determined according to the following hierarchy.


例如,如果您有 NVMe 和 Ssd,NVMe 快取將 Ssd 的。For example, if you have NVMe and SSDs, the NVMe will cache for the SSDs.

如果您有 Ssd 和 HDDs,Ssd 將 HDDs 快取。If you have SSDs and HDDs, the SSDs will cache for the HDDs.


快取的磁碟機,而不會使用儲存空間容量。Cache drives do not contribute usable storage capacity. 快取中儲存的所有資料也會儲存在其他地方,或將一旦取消接。All data stored in the cache is also stored elsewhere, or will be once it de-stages. 這表示您的部署的總的原始儲存空間容量的容量磁碟機只總和。This means the total raw storage capacity of your deployment is the sum of your capacity drives only.

相同類型的所有磁碟機時,會自動設定不快取。When all drives are of the same type, no cache is configured automatically. 您可以手動設定要較低-耐力相同的類型的磁碟機的快取更高版本-耐力磁碟機–查看手動設定一節,以了解如何。You have the option to manually configure higher-endurance drives to cache for lower-endurance drives of the same type – see the Manual configuration section to learn how.


在所有-NVMe 或所有-SSD 部署,尤其是在非常小縮放,有任何「花費」的快取的磁碟機可以改善可以提升儲存效率有意義。In all-NVMe or all-SSD deployments, especially at very small scale, having no drives "spent" on cache can improve storage efficiency meaningfully.

快取的問題,會自動設定Cache behavior is set automatically

快取的問題時判斷自動根據類型的磁碟機問題的快取的。The behavior of the cache is determined automatically based on the type(s) of drives that are being cached for. 當固態磁碟機(例如 NVMe 快取的 Ssd)的快取,只有寫入的快取。When caching for solid-state drives (such as NVMe caching for SSDs), only writes are cached. 在快取的硬碟機(例如 Ssd 快取的 HDDs),這兩讀取和寫入快取。When caching for hard disk drives (such as SSDs caching for HDDs), both reads and writes are cached.


Write-only 所有-flash 部署的快取Write-only caching for all-flash deployments

當固態磁碟機(NVMe 或 Ssd)的快取,只有寫入的快取。When caching for solid-state drives (NVMe or SSDs), only writes are cached. 這樣可以降低穿著磁碟機因為許多寫入和重新寫入可以聯合快取中,然後取消階段僅限時,減少累積傳輸到容量的磁碟機和擴充他們期間容量。This reduces wear on the capacity drives because many writes and re-writes can coalesce in the cache and then de-stage only as needed, reducing the cumulative traffic to the capacity drives and extending their lifetime. 基於這個原因,我們建議您選取 [更高版本-耐力、寫入最佳化的快取的磁碟機。For this reason, we recommend selecting higher-endurance, write-optimized drives for the cache. 容量磁碟機合理可能會有較低寫入耐力。The capacity drives may reasonably have lower write endurance.

由於讀取不會大幅會影響的網站,壽命與固態磁碟機通用提供低讀取延遲,因為讀取不快取︰ 它們直接從容量磁碟機(除了時資料寫入動作最近的它不提供尚未已取消分段)。Because reads do not significantly affect the lifespan of flash, and because solid-state drives universally offer low read latency, reads are not cached: they are served directly from the capacity drives (except when the data was written so recently that it has not yet been de-staged). 這樣會致力於可以寫字,完全快取提高其效率。This allows the cache to be dedicated entirely to writes, maximizing its effectiveness.

這會導致寫入特性,例如延遲寫入正在聽寫的快取的磁碟機,時朗讀特性依照容量磁碟機。This results in write characteristics, such as write latency, being dictated by the cache drives, while read characteristics are dictated by the capacity drives. 兩者都一致,可預測,且統一。Both are consistent, predictable, and uniform.

讀取/寫入混合部署的快取Read/write caching for hybrid deployments

快取的硬碟機 (HDDs),這兩個讀取時將的快取,同時提供 flash 類似的延遲通常 ~ 10 x 更好。When caching for hard disk drives (HDDs), both reads and writes are cached, to provide flash-like latency (often ~10x better) for both. 最近與經常讀取以便快速存取和隨機流量 HDDs 最小化資料的讀取快取存放區。The read cache stores recently and frequently read data for fast access and to minimize random traffic to the HDDs. (搜尋,旋轉延遲因為遺失的時間的隨機存取 HDD 收取與延遲非常重要。)快取吸收突發,為之前,若要聯合寫入寫入並重新寫入最小化累積容量磁碟機傳輸。(Because of seek and rotational delays, the latency and lost time incurred by random access to an HDD is significant.) Writes are cached to absorb bursts and, as before, to coalesce writes and re-writes and minimize the cumulative traffic to the capacity drives.

儲存空間直接存取實作取消隨機放置個寫入之前取消試用它們,模擬磁碟似乎連續甚至來自(例如虛擬機器)工作負載的實際 IO 時隨機 IO 模式的演算法。Storage Spaces Direct implements an algorithm that de-randomizes writes before de-staging them, to emulate an IO pattern to disk that seems sequential even when the actual IO coming from the workload (such as virtual machines) is random. 這發揮最大的輸送量 HDDs 與 IOPS。This maximizes the IOPS and throughput to the HDDs.

快取中的所有三種類型的磁碟機部署Caching in deployments with drives of all three types

當所有三種類型的磁碟機出現時,NVMe 磁碟機提供 Ssd 和 HDDs 快取。When drives of all three types are present, the NVMe drives provides caching for both the SSDs and the HDDs. 如上文所述的行為,是:僅寫入的快取 Ssd,且讀取和寫入快取的 HDDs。The behavior is as described above: only writes are cached for the SSDs, and both reads and writes are cached for the HDDs. 快取的 HDDs 負擔平均分散在快取磁碟機。The burden of caching for the HDDs is distributed evenly among the cache drives.


此表格摘要的磁碟機用於快取,用來的容量,快取的問題會針對每個部署的可能性。This table summarizes which drives are used for caching, which are used for capacity, and what the caching behavior is for each deployment possibility.

部署Deployment 快取的磁碟機Cache drives 容量磁碟機Capacity drives 快取的問題(預設值)Cache behavior (default)
所有 NVMeAll NVMe 無 (可省略:手動設定)None (Optional: configure manually) NVMeNVMe Write-only(如果設定)Write-only (if configured)
所有 SSDAll SSD 無 (可省略:手動設定)None (Optional: configure manually) SSDSSD Write-only(如果設定)Write-only (if configured)
NVMe + SSDNVMe + SSD NVMeNVMe SSDSSD Write-onlyWrite-only
NVMe + HDDNVMe + HDD NVMeNVMe HDDHDD 朗讀 + 寫入Read + Write
SSD + HDDSSD + HDD SSDSSD HDDHDD 朗讀 + 寫入Read + Write
NVMe + SSD + HDDNVMe + SSD + HDD NVMeNVMe SSD + HDDSSD + HDD 讀取 + 撰寫 HDD,Write-only SSD 的Read + Write for HDD, Write-only for SSD

伺服器端架構Server-side architecture

快取係磁碟機層級:個人的快取中一部伺服器的磁碟機繫結至一或多個容量磁碟機,在相同的伺服器。The cache is implemented at the drive level: individual cache drives within one server are bound to one or many capacity drives within the same server.

快取低於 Windows 軟體定義儲存堆疊的其餘部分,因為它會不有也不需要的概念,例如儲存空間或容錯能力,任何感知。Because the cache is below the rest of the Windows software-defined storage stack, it does not have nor need any awareness of concepts such as Storage Spaces or fault tolerance. 您可以將它與建立」混合」(部分 flash、部分磁碟)磁碟機,然後向 Windows。You can think of it as creating "hybrid" (part flash, part disk) drives which are then presented to Windows. 如同實際混合式磁碟機即時的作用中且冰凍資料更快速且慢部分實體媒體之間移動看不見幾乎外。As with an actual hybrid drive, the real-time movement of hot and cold data between the faster and slower portions of the physical media is nearly invisible to the outside.

在 [儲存空間直接存取指定該恢復是至少伺服器層級(亦即的資料到不同的伺服器; 在每個伺服器大部分一份複本一定會寫入),在資料相同恢復為快取中找不到資料的快取權益。Given that resiliency in Storage Spaces Direct is at least server-level (meaning data copies are always written to different servers; at most one copy per server), data in the cache benefits from the same resiliency as data not in the cache.


例如使用三向鏡像、時的任何資料三個複本寫入到不同的伺服器,它們登陸快取中的位置。For example, when using three-way mirroring, three copies of any data are written to different servers, where they land in cache. 無論是否他們稍後取消分段安裝或不,一律會有三種複本。Regardless of whether they are later de-staged or not, three copies will always exist.

磁碟機繫結的動態Drive bindings are dynamic

繫結之間快取,並容量磁碟機可以讓 1:1 向上 1:12 以及以外的任何比例。The binding between cache and capacity drives can have any ratio, from 1:1 up to 1:12 and beyond. 動態調整時新增或移除,例如時磁碟機或之後失敗縮放比例。It adjusts dynamically whenever drives are added or removed, such as when scaling up or after failures. 這表示,您可以新增快取的磁碟機或容量磁碟機獨立,隨時。This means you can add cache drives or capacity drives independently, whenever you want.


我們建議您進行容量的磁碟機多的快取的磁碟機,對稱用於數目。We recommend making the number of capacity drives a multiple of the number of cache drives, for symmetry. 例如您有 4 快取的磁碟機,如果您將體驗 8 容量磁碟機(1:2 比)比 7 或 9 的更多甚至效能。For example, if you have 4 cache drives, you will experience more even performance with 8 capacity drives (1:2 ratio) than with 7 or 9.

快取的磁碟機故障的處理Handling cache drive failures

快取磁碟機失敗時,會遺失任何寫入尚未完成取消階段的到本機伺服器,這表示這些只存在於的其他複製(在 [其他伺服器)。When a cache drive fails, any writes which have not yet been de-staged are lost to the local server, meaning they exist only on the other copies (in other servers). 就像任何其他磁碟機故障之後, 儲存空間可以和會自動修復諮詢仍正常運作的複本。Just like after any other drive failure, Storage Spaces can and does automatically recover by consulting the surviving copies.

短暫,會顯示不佳的繫結至遺失快取磁碟機的容量磁碟機。For a brief period, the capacity drives which were bound to the lost cache drive will appear unhealthy. 快取結發生(自動)並完成(自動)資料修復之後,他們將會繼續顯示為健康。Once the cache rebinding has occurred (automatic) and the data repair has completed (automatic), they will resume showing as healthy.

本案例是在至少兩快取所需的每個保留效能伺服器磁碟機的原因。This scenario is why at minimum two cache drives are required per server to preserve performance.


您可以再取代就像任何其他磁碟機更換快取磁碟機。You can then replace the cache drive just like any other drive replacement.


您可能需要電源下安全地取代 NVMe 的 Add-In 卡 (AIC) 或 M.2 尺寸為何。You may need to power down to safely replace NVMe that is Add-In Card (AIC) or M.2 form factor.

其他快取的關係Relationship to other caches

有幾個其他不相關的快取中 Windows 軟體定義儲存堆疊。There are several other unrelated caches in the Windows software-defined storage stack. 範例包含儲存空間回寫快取,並叢集共用磁碟區 (CSV) 記憶體中的朗讀快取。Examples include the Storage Spaces write-back cache and the Cluster Shared Volume (CSV) in-memory read cache.

儲存空間直接存取、使用儲存空間回寫快取不應修改其預設行為。With Storage Spaces Direct, the Storage Spaces write-back cache should not be modified from its default behavior. 例如,例如參數-WriteCacheSize新磁碟區cmdlet 不應該使用。For example, parameters such as -WriteCacheSize on the New-Volume cmdlet should not be used.

您可以選擇要使用 CSV 快取–一切操之在您。You may choose to use the CSV cache, or not – it's up to you. 在 [儲存空間直接存取、預設為關閉,但不是衝突新快取以任何方式本主題中所述。It is off by default in Storage Spaces Direct, but it does not conflict with the new cache described in this topic in any way. 在某些案例中,它可以提供提高可及範圍寶貴的效能。In certain scenarios it can provide valuable performance gains. 如需詳細資訊,請查看如何讓 CSV 快取For more information, see How to Enable CSV Cache.

手動設定Manual configuration

針對大部分部署,就不需要手動設定。For most deployments, manual configuration is not required. 以方便您在需要用它,讀取上!In case you do need it, read on!

指定磁碟機的快取模型Specify cache drive model

在所有的磁碟機所在的相同的類型,例如所有-NVMe 或所有-SSD 部署,部署不快取被設定,因為 Windows 無法區分特性像是撰寫耐力自動之間相同類型的磁碟機。In deployments where all drives are of the same type, such as all-NVMe or all-SSD deployments, no cache is configured because Windows cannot distinguish characteristics like write endurance automatically among drives of the same type.

若要使用較低-耐力相同的類型的磁碟機的快取更高版本-耐力磁碟機,您可以指定搭配使用的磁碟機機型-CacheDeviceModel的參數讓-ClusterS2D cmdlet。To use higher-endurance drives to cache for lower-endurance drives of the same type, you can specify which drive model to use with the -CacheDeviceModel parameter of the Enable-ClusterS2D cmdlet. 一旦支援儲存空間直接存取、該型號的所有磁碟機將會用於快取。Once Storage Spaces Direct is enabled, all drives of that model will be used for caching.


請務必符合模型字串的輸出中出現取得-平均Be sure to match the model string exactly as it appears in the output of Get-PhysicalDisk.


PS C:\> Get-PhysicalDisk | Group Model -NoElement

Count Name
----- ----
    8 FABRIKAM NVME-1710
   16 CONTOSO NVME-1520

PS C:\> Enable-ClusterS2D -CacheDeviceModel "FABRIKAM NVME-1710"

您就可以驗證您想要的磁碟機的問題用於執行快取取得-平均中 PowerShell 確認他們使用屬性標示為「筆記本」You can verify that the drives you intended are being used for caching by running Get-PhysicalDisk in PowerShell and verifying that their Usage property says "Journal".

手動部署可能性Manual deployment possibilities

手動設定可讓下列部署可能性:Manual configuration enables the following deployment possibilities:


設定快取的問題Set cache behavior

很可能會覆寫預設的快取的行為。It is possible to override the default behavior of the cache. 例如,設為 [快取讀取能在所有的快閃部署。For example, you can set it to cache reads even in an all-flash deployment. 我們會防止修改除非您有特定預設不會並不適用於您的工作負載的行為。We discourage modifying the behavior unless you are certain the default does not suit your workload.

若要覆寫的行為,使用設定-ClusterS2D cmdlet 及其-CacheModeSSD-CacheModeHDD參數。To override the behavior, use Set-ClusterS2D cmdlet and its -CacheModeSSD and -CacheModeHDD parameters. CacheModeSSD參數設定快取的行為,在固態磁碟機的快取。The CacheModeSSD parameter sets the cache behavior when caching for solid-state drives. CacheModeHDD參數設定快取的行為,在快取的硬碟機。The CacheModeHDD parameter sets cache behavior when caching for hard disk drives. 這可以在任何時候之後支援儲存空間直接存取。This can be done at any time after Storage Spaces Direct is enabled.

您可以使用取得-ClusterS2D以確認已設定的行為。You can use Get-ClusterS2D to verify the behavior is set.


PS C:\> Get-ClusterS2D

CacheModeHDD : ReadWrite
CacheModeSSD : WriteOnly

PS C:\> Set-ClusterS2D -CacheModeSSD ReadWrite

PS C:\> Get-ClusterS2D

CacheModeHDD : ReadWrite
CacheModeSSD : ReadWrite

調整大小快取Sizing the cache

快取應該要調整大小,以配合的工作集中(的資料會主動讀取或任何時候寫入)應用程式和工作負載。The cache should be sized to accommodate the working set (the data being actively read or written at any given time) of your applications and workloads.

這是尤其在混合部署的硬碟機。This is especially important in hybrid deployments with hard disk drives. 如果使用中的工作集中超出大小的快取,或使用中的工作設定 drifts 得太快,讀取快取遺漏會增加和寫入需要更多時會較為緩和,將取消暫存影響整體效能。If the active working set exceeds the size of the cache, or if the active working set drifts too quickly, read cache misses will increase and writes will need to be de-staged more aggressively, hurting overall performance.

您可以使用建效能監視器 (PerfMon.exe) 公用在 Windows 中檢查的快取遺失的速率。You can use the built-in Performance Monitor (PerfMon.exe) utility in Windows to inspect the rate of cache misses. 具體而言,您可以比較快取遺漏讀取秒叢集儲存混合式磁碟以整體計數器設定朗讀 IOPS 部署。Specifically, you can compare the Cache Miss Reads/sec from the Cluster Storage Hybrid Disk counter set to the overall read IOPS of your deployment. 每個」混合式磁碟 [對應至容量一部磁碟機。Each "Hybrid Disk" corresponds to one capacity drive.

例如,2 快取繫結至 4 容量磁碟機會導致每個伺服器 4「混合式磁碟「物件執行個體的磁碟機。For example, 2 cache drives bound to 4 capacity drives results in 4 "Hybrid Disk" object instances per server.


有任何通用規則,但如果太多讀取遺失快取,可能會太小,並考慮新增到您的快取的展開快取的磁碟機。There is no universal rule, but if too many reads are missing the cache, it may be undersized and you should consider adding cache drives to expand your cache. 您可以新增快取的磁碟機或容量磁碟機獨立隨時。You can add cache drives or capacity drives independently whenever you want.

也了See also