Machine Creation Services Storage I/O Optimization (MCS I/O) trades RAM usage in the Guest Operating System running the Virtual Delivery Agent (VDA) for reduce storage I/O load (IOPS) on central storage.
Depending on workloads, using the default configuration of 256 MB of RAM Cache for VDI workers along with a Temporary Cache Disk has shown that write IOPS can be totally removed from central storage coupled with a dramatic reduction of storage based write IOPS as most of the writes are cached in RAM (599 IOPS down to a hardly noticeable 19), Figure 1. Also, increasing the size of the RAM Cache from the default 256 MB to 512 MB can totally eliminate write IOPs to the Temporary Cache Disk. However, on resource constrained systems, getting the right trade-off is a bit of a balancing act.
Following on from the series of MCS I/O posts from Rakesh Kumar, this post shares insights into RAM Cache size consideration on resource constrained systems, in particular, 32 bit Virtual Desktop Infrastructure (VDI) workers.
Some Windows Internals:
On 32 bit x86 Windows Operating Systems, without extended physical addressing and other memory tuning options, the system is limited to 4 GB of physical memory with a split of a 2 GB virtual address space for User-mode processes and a 2 GB Kernel-mode virtual address space. Using memory tuning options such as 4-Gigabyte Tuning (4GT), enabled with the BCDEdit “IncreaseUserVa” option, increases the address space available to User-mode processes with high memory requirements up to 3 GB with a corresponding decrease to 1GB of the address space available for Kernel-mode, Figure 2.
The Kernel-mode address space is further split into two main types of memory areas, Paged-Pool and Non-Paged Pool, Figure 3. On Windows versions prior to 8.1, the Non-Paged Pool limit is either 75% of RAM or 2 GB, whichever is the smaller amount.
- Paged-Pool – Contains device driver code and Kernel structures that can be Paged in and out from disk.
- Non-Paged Pool – Contains device driver code and Kernel structures that will always be resident in physical memory.
MCS I/O Memory Usage:
When configuring Machine Catalogs with MCS I/O, setting the “Memory allocated to cache” (RAM Cache size) shown in Figure 4 will configure the amount of Non-Paged Pool memory the MCS I/O driver will use on the VDA to perform its caching operations, Figure 5. The amount of memory chosen to use for the cache will also have to be shared with other device drivers and Kernel structures that always need to be resident in physical memory.
The RAM Cache size is also a target size rather than an absolute limit. There can be an overshoot of approximately 50% over the target RAM Cache size while older cache data is overflowed to the Temporary Cache Disk, Figure 6. This overshoot helps to maintain a reasonable level of performance while the older cache data is overflowed to the Temporary Cache Disk.
Using Non-Paged Pool Can Exhaust All RAM:
Given the limited amount of Kernel-mode Non-Paged Pool memory available on a 32 bit system, and given that configuring 256 MB for the RAM Cache could use in the region of 400 MB, configuring a larger RAM cache size such as 512 MB could end up trying to use in the region of 800 MB which may be more than the available Non-Paged Pool memory. Once all of the available Non-Paged Pool memory has been consumed, you can expect system instability, hangs or Stop Errors (BSODs). To avoid this situation, you must measure your RAM needs and size accordingly. Figure 7 shows a couple of PowerShell queries that can be used to measure the total amount of Non-Paged Pool memory in use as well as the amount of Non-Paged Pool memory used by the MCS I/O driver.
The MCS I/O feature trades RAM usage for reduced storage I/O load. To get the best benefit from the feature ideally requires the use of 64 bit Operating Systems which have larger physical memory limits (192 GB for Windows 7 Professional) along with larger Kernel-mode Non-Paged Pool memory limits (75% of RAM up to 128 GB for Windows 7) . If there is a requirement to use older 32 bit Operating Systems and you would still like to gain benefits from MCS I/O, setting the RAM Cache size to no higher than the default 256 MB is probably the best balance between reduced I/O load and stable system operation.