29th October 2010

Free Windows Server Memory for Hyper-V

So Windows (like most OSes) maintains a number of caches where it keeps in RAM frequently accessed disk contents (as well as a few other things). Normally these are not adjustable- it just uses extra free memory for this to improve performance, and the minute you actually need the memory, it is freed up and available to a real program.

Hyper-V puts a little twist in this. When you create or start up a new VM, it needs the full memory as hard-allocated memory to that VM and apparently it doesn’t force a cache clear if there isn’t enough memory available. We are building a bunch of stuff on 48GB servers and initially thought we would easily be able to put 3x 15GB VMs on them- the remaining 3GB would be plenty for the OS that basically wasn’t doing anything. But at times we have found the Cached memory is as high as 20GB (after a bunch of big file copies, usually of VHD images), and the machine doesn’t have enough free RAM to boot the target VMs.

Any thoughts on how we can clear this? Dynamic memory coming in future releases should fix this issue, but for now it would be great if we could just run a cache clear/flush right before VM start time.

posted in Microsoft, Technology, Virtualization | 2 Comments