Guest Paging vs. Virtualization Paging and Negative Memory Availability

Jeff has discussed this at some length over on the virtualization team blog, but as a general rule of thumb we believe that it is much better to have paging occur inside the guest operating system rather than at the virtualization layer (if paging is needed).

The simple reason for this is that the guest operating system has far better understanding of which are the best sections of memory to page out – where as all the virtualization layer can do is to guess at what should be paged out.

In my recent demonstrations of dynamic memory I came upon another interesting angle to consider.  Here is a screenshot of task manager from a virtual machine that is running at –23% memory availability (i.e. it does not have enough memory available and is paging in the guest):

image

What is fascinating about this screenshot is that even though this virtual machine is significantly short of memory, the guest operating system is still keeping 112mb memory available / as file cache.  The reason for this is that the copy of Windows inside the virtual machine knows that even though it is short of memory – it can provide the best experience for the user of the virtual machine by not using all the memory that it has and by keeping a little bit free to serve as a cache / be there for new applications.

It is exactly this sort of logic that gets lost when paging is done at the virtualization layer instead of inside the guest operating system.

Cheers,
Ben

Comments

  • Anonymous
    September 02, 2010
    Speaking of demonstrations - I was at your TechEd presentation (in New Zealand) on Monday.  I was very impressed, both with the technology itself and the quality of the presentation.

  • Anonymous
    September 02, 2010
     Out of curiosity; has a hybrid approach been tried.      Instead of any file access going to the paging file in the VM's VHD -- it gets re-routed to the Hyper-V and the VM Memory Manager decides how it wants to "page" it for the guest.  It could page it to unused ram, or to its own paging file.   Seems to me that would be the best of both worlds.  The VM Manager knows exactly how much memory is physically available; and it probably has a faster disk read/write access by not going to a vhd.  And you could configure certain machines to have preference to Memory VM rather than to Disk VM.  And if that Memory is needed then HV could page it to file like normal anyways.

  • Anonymous
    September 02, 2010
    The comment has been removed

  • Anonymous
    September 16, 2010
    So at a simplistic level are you saying that we should disable or reduce the host's pagefile to say 200mb (enough for a dumpfile) to enforce the fact that swapping only occurs within the guests and not at the hypervisor level?