«

»

Aug 18 2010

Pagefiles and VDI. Not so simple.

Windows Virtual memory, also known as Windows pagefiles, has been part of Microsoft Windows since Windows 3.0. Microsoft introduced virtual memory in response to the failures of Windows 1.0 and Windows 2.0, attempting to slash resource requirements for the operating system. Since then, not much has been discussed about paging until VDI became mainstream.

Not many technologies can be so simple and at the same time so complex to manage and understand. Because of that I have put in order a recollection of articles and recommended practices to help us better understand what steps can and should be taken to optimize disk swapping performance.

A virtual machine will almost often have two types of pagefile.

1. Windows Pagefile (pagefile.sys)

2. .vswp (memory overcommitment on a ESX server)

Before discussing both type of swap it’s important to understand that ESX server uses an advanced technique to optimize memory utilization in the system. These techniques include Transparent Page Sharing (TPS), ballooning and swapping. ESX scans the memory used by virtual machines to determine identical memory pages and transparently collapse them into single copies that are accessed (read-only) by all the VMs.

Ballooning is the technique used by ESX to force a guest system to swap inactive memory pages to its internal pagefile (1) and utilize the freed physical RAM to serve other active VMs. As a fallback, when the system memory is overly utilized, ESX will swap to disk memory from virtual machines (2). Each virtual machine has its own .vswap file maintained by ESX.

(2) “VM disk swap (.vswp) is created if the reservation is less than 100% of a virtual machine’s RAM. The size of the swap file is equal to the unreserved portion of guest RAM. For example, if 50% of guest RAM is reserved and guest RAM is 2GB, the .vswp is 1GB.” vSphere4 – Desktop virtualization notes If the host is already under heavy memory contention the last thing you want is to create another point of contention.

“It’s a good idea to either create partial memory reservation for your VM’s or specify an alternate location for this file so it does not use up valuable VMFS SAN space. By creating a partial memory reservation you can decrease the size of this file and still allow for memory overcommitment, you also allow for ESX to use its advanced memory techniques such as page sharing. Alternately you can specify an alternate location for the .vswp file so it is not stored in the same directory as your .vmdk files.” esiebert7625

(1) “The Windows OS starts paging when 75 percent of its memory is allocated. It will always try to keep at least 25 percent free. But paging in virtual environments is a performance-­killer. So instead of giving it the recommended (in physical systems) amount of 1.5 to 2 times the amount of memory in swap space, we limit the pagefile size to a fixed amount of 200 to perhaps 500 MB. If that is not enough, just add more RAM to the client, rather than extending the pagefile.” Petervandenbosch

“As this data is transient in nature we can save a fair amount of storage and/or bandwidth capacity by removing this data out of the datastore, which contains the production data. In order to accomplish this design the VM’s swap or pagefile must be relocated to a second virtual disk, stored in a separate datastore.” NetApp and VMware Virtual Infrastructure 3 Storage Best Practices

“Blocks of data are written in sequence to all disks in a RAID0 set but only to one at the time. So if one disk in the set fails, all data from the set of disks is lost. But because there is no overhead in a RAID0 set, it is the fastest way of reading and writing data. In practice this can only be used for volatile data like temporary files and temporary caches, and also perhaps for pagefiles. If used, the amount of IOPS a RAID0 set can provide with 15,000 RPM disks is 150-­160 for reads and 140-­150 for writes.” Deep Impact

When dealing with VMware View and virtual machines using Linked Cloning things start to get even more interesting. Because, by default, the pagefile is located on C:\, every time Windows swap memory to disk the delta .vmdk is incremented consuming additional storage space. It is a good practice, even when using Linked Clones, to create a new .vmdk specific for Windows virtual memory. I have also tested using pagefile on UDD (User data Disk) and that is also works well even after the machine is provisioned. If you still have doubts about how linked cloning technology works look here, here and here.

The flow below demonstrates the steps you can take to provide your VDI environment with the best swap management.

image

The same steps are applicable to any virtual machine with or without Linked Clone.

Similar Posts:

Permanent link to this article: http://myvirtualcloud.net/?p=1050

5 comments

4 pings

Skip to comment form

  1. Greg Fox

    The issue with RAID 0 is reliability – if you lose a single disk in the set the volume is gone.

    What would the impact of losing .vswp and pagefile .VMDK be on a running VM?

    Does this risk outweigh the performance gain, especially since as you add more disks to the stripe set, you increase the likelihood of failure.

  2. PiroNet

    That would be much easier if the client OS was VDI aware and could behave accordingly!
    When will Microsoft deliver such client OS? Or we might wait for a third party company to the do the job and come out with such killing app, And later being bought by M$ I guess :)

  3. Andre Leibovici

    @PiroNet
    Agreed. Have a read on my article about the future of Desktop Virtualization.

    http://myvirtualcloud.net/?p=957

  4. Andre Leibovici

    @Greg Fox
    If you are concerned about reliability a possible solution would be to have RAID1 using ESSD. Solid State Drives will provide you you much better IOPS at extra cost. Now, if you got plenty of disks and shelf’s available just go for RAID 1+0.

    As a quick example, this number may easily reach 2 TB for 3000 users.

  5. Rickard Nobel

    It says in the article that Windows will swap at 75% memory usage, but I think that might be true for older versions. For Windows 7 for example you can study the Pagefile usage % in performance monitor and it is often zero even when having a very high physical memory usage.

  1. thevirtualnews.com

    myvirtualcloud.net » Pagefiles and VDI. Not so simple….

    Windows Virtual memory, also known as Windows pagefiles, has been part of Microsoft Windows since Windows 3.0. Microsoft introduced virtual memory in response to the failures of Windows 1.0 and Windows 2.0, attempting to slash resource requirements for…

  2. View ???? « ?'s Blog

    […] Reference? Configuring vNetwork Distributed Switch for VMware View?http://myvirtualcloud.net/?p=1012 Pagefiles and VDI. Not so simple?http://myvirtualcloud.net/?p=1050 […]

  3. - Cliff Davies

    […] for VDI environments has been a long standing discussion ground. I first wrote about it in 2010 (Pagefiles and VDI. Not so simple). However, because of few recent discussions I decided to review the subject and run some […]

  4. VDI + Windows PageFile Done Right! « Thincomputing.net

    […] for VDI environments has been a long standing discussion ground. I first wrote about it in 2010 (Pagefiles and VDI. Not so simple). However, because of few recent discussions I decided to review the subject and run some […]

Leave a Reply