Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET
Windows Server 2012

Configuring Cluster Shared Volumes (CSV) Cache

In this post I will show you how enable Cluster Shared Volumes (CSV) Cache to improve the read performance of CSV in Windows Server 2012 (WS2012) and Windows Server 2012 R2 (WS2012 R2) by using just a little bit (or a lot if you want) of RAM from your server.

What Is Cluster Shared Volumes (CSV) Cache?

Primarily intended for Hyper-V, CSV Cache, sometimes referred to as CSV Block Cache, allows you to assign some of a memory of your server as a write-through cache to improve the read performance (read-only unbuffered I/O to be specific) of virtual machines’ virtual hard disks. That means that the server’s will cache virtual hard disk reads in RAM and hit that RAM instead of accessing the more latent disks on which the CSV is stored.

There are two designs on which CSV Cache is useful:

  • Hyper-V Hosts: Your hosts are directly connected to storage, such as a SAN (not SMB 3.0), and use CSVs to store virtual machines. In this case, you enable CSV Cache on the clustered Hyper-V hosts.
  • Scale-Out File Server (SOFS): You are using a Scale-Out File Server (SOFS), which uses CSV to have active-active disk for transparent failover and continuous SMB 3.0 service availability. In this situation, you enable CSV Cache on the nodes in the SOFS cluster, and not on the Hyper-V hosts.

Note: A SOFS that uses tiered Storage Spaces will not use CSV Cache.

Sponsored Content

Say Goodbye to Traditional PC Lifecycle Management

Traditional IT tools, including Microsoft SCCM, Ghost Solution Suite, and KACE, often require considerable custom configurations by T3 technicians (an expensive and often elusive IT resource) to enable management of a hybrid onsite + remote workforce. In many cases, even with the best resources, organizations are finding that these on-premise tools simply cannot support remote endpoints consistently and reliably due to infrastructure limitations.

CSV Cache is best used in read-intensive scenarios. Examples of this might be:

  • VDI where virtual machines are mostly identical
  • Server virtualization where a CSV contains just operating system virtual hard disks (a very complicated design to automate and manage)

CSV Cache: RAM Requirements

This is the beauty of CSV Cache: Microsoft found that just 512 MB of RAM from each server connected directly to the CSV could make a big difference, particularly in the case of pooled VDI. WS2012 allows you to assign up to 20 percent of RAM in a server to CSV Cache. That was great for Hyper-V hosts. However, SOFS nodes might have much more content that could be optimized with caching. Twenty percent of 8 GB of RAM is not very much. That is why you can dedicate up to 80 percent of RAM in a server to CSV Cache in WS2012 R2.

Enable and Configure CSV Cache

In WS2012 there are two steps to enable and configure CSV cache:

  • Configure BlockCacheSize: BlockCacheSize is a cluster-wide property; this setting is zero by default and defines the amount of RAM in megabytes that is reserved by each cluster member for CSV Cache.
  • Set EnableBlockCache for each CSV: You turn on this setting for each CSV that will cache read-only buffered I/O using CSV Cache.

Note that WS2012 R2 has EnableBlockCache enabled by default for each CSV. You might want to consider disabling caching for some CSVs so that you focus your resources on other CSVs where read performance is more important.

CSV Cache is configure only from PowerShell – there is no GUI option. You can query the amount of RAM that is reserved on each cluster member for CSV Cache by running the following: (Get-Cluster).BlockCacheSize

The above command can be run on any of the cluster members; EnableBlockCache is a cluster-wide setting that is synchronized across each node in the cluster.

The following command will be run once per cluster to set the size of the CSV Cache. This setting is automatically synchronized by the cluster’s nodes. The next example will configure each cluster member to use up to 512 MB for caching: (Get-Cluster).BlockCacheSize = 512

In WS2012 you will have to enable selected CSVs to make use of this cache. WS2012 R2 CSVs will use the cache by default. To query a CSVs caching status you can run the following. A value of 1 indicates that caching is enabled and a value of 0 indicates that caching is disabled.

Get-ClusterSharedVolume | Get-ClusterParameter | where {$_.Name -eq "EnableBlockCache"}

The next command will enable CSV Cache for a CSV called “CSV1.” You can disable caching by changing the CsvEnableBLockCache value to 0.

Get-ClusterSharedVolume “CSV1” | Set-ClusterParameter CsvEnableBlockCache 1

CSV Cache Monitoring

A number of metrics are available to you to monitor the performance and usage of the CSV Cache. Each of these counters is available under Cluster CSV Volume Cache in Performance Monitor.

Selecting CSV Cache performance metrics.
Selecting CSV Cache performance metrics.

You can add these metrics to determine just how much optimization CSV Cache is providing and to help you tune the size of the CSV Cache for your cluster.

Monitoring the performance of CSV Cache
Monitoring the performance of CSV Cache.

Summary

CSV Cache is a fantastic feature that provides huge improvements to performance – for example, by reducing the length of a VDI boot storm. You can use a small percentage of RAM in your Hyper-V hosts to improve their CSV read performance, or you can assign 80 percent of the RAM in your SOFS nodes to greatly improve the performance of your SMB 3.0 storage.

Related Topics:

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: