I’ve done a fair bit of work now with Windows Server 2008 and 2008R2 and Hyper-V. One of the key things I’ve looked at is how to correctly size the pagefile for these systems for the host machine. I’ve searched high and low for a real recommendation from Microsoft on this topic and sadly have not been able to find anything concrete to use as a guide.
In short – I recommend a fixed size 4GB pagefile for my Hyper-V host. This recommendation is based on Windows Server 2008 and Windows Server 200R2 WITHOUT SP1 with the Hyper-V roles enabled. Windows Server 2008 R2 SP1 introduced the concept of dynamic memory for the guest machines and at present, I don’t have enough experience with it to make a judgement call. If you want to know why and how I come to that then read on below.
Ok – so when you can’t find anything concrete what do you do? You use the knowledge that you have to figure out what seems reasonable and then put that to the test in a real world situation. The knowledge below is the summation now of the last few years of running both test and production environments on Hyper-V and from all experiences so far seems to be very accurate indeed.
So what do we do? First up I looked at Microsoft “normal” recommendation is to use 1.2 to 2 times the size of physical RAM for a pagefile on a Windows machine. Microsoft make this recommendation based on the fact that the total RAM requirement of the programs you run simultaneously on the machine will be well in excess of the physical RAM in the machine. Having a page file either system managed or fixed at a specific size, allows the system to page to disk sections of RAM that are not being used so that it can be freed up for other programs to use them. This is “common” knowledge in the industry and pretty accurate.
Well then how does Hyper-V work? Firstly, Windows Server with Hyper-V or Windows Hyper-V server both handle RAM in the same way – so for the purposes of this FAQ, we’ll call them the same. When you create a guest machine in Hyper-V you allocate it a fixed amount of RAM to that Virtual machine. Microsoft recommend and have hard coded blocks in place that mean you can never start more virtual machines than you have physical RAM for. Microsoft also recommend you leave at least 512MB to 1GB of free RAM for the base Windows Host installation to process it’s things. In addition to that Microsoft also recommend that you do not run any other programs or services on the Hyper-V host therefore limiting the amount of RAM they can consume. If we are limit the programs that we run on the host machine, it also therefore limits the amount of pagefile we will need. I figured some time back that it was pretty safe to allocate a 4GB fixed page file as in reality nothing on the Hyper-v Host should really be being paged out to it in the first place. Based on perfmon indicators on my hyper-V hosts this is pretty accurate and the only time the pagefile gets hit is when I’m running other programs on the Hyper-V hosts itself. Therefore I’ve come to the conclusion that 4GB is more than enough for me. Could I allocate less? Yes probably, but disk is pretty cheap and 4GB is nothing to worry about. On the other hand had I left it as a system managed pagefile then Windows would start by allocating at least the physical RAM amount of space for the pagefile – which on some of my systems is 64GB+ – and that just does not make sense to me.
That’s what I’m doing – how about yourself – do you have any thoughts to contribute?