Parent memory reserve with dynamic memory

Most people I know who have spent a lot of time with Hyper-V have had the experience of accidentally taking too much memory away from the parent partition.  This happens when they start too many virtual machines – and all of a sudden the performance and responsiveness of the parent partition goes down significantly.

The response from people who hit this is usually to stop the last virtual machine that they started, to reduce its memory, and then start it up again.

This solution has worked in the past – but is no longer an option with dynamic memory.  The reason why this will not work is because if you stop the last virtual machine – you just leave the memory available for your other virtual machines to use – getting you straight back where you started.

For this reason, with dynamic memory we have implemented a new “parent memory reserve” for Hyper-V.  Here we attempt to calculate an appropriate amount memory to keep for the parent partition and ensure that virtual machines with dynamic memory enabled cannot eat into this reserved memory.

That said – this reserve is not perfect.  Specifically – it only accounts for the memory requirements of Hyper-V in the parent partition.  If you are running other workloads in the parent partition (contrary to our best practice guidance) then you may still see parent partition memory starvation.

To help mitigate this issue – we are also providing a new registry entry that lets you override our parent memory reserve with your own static memory reserve.  This registry entry does not exist by default – but if you go to the HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionVirtualization registry key and create a new DWORD entry with a name of memoryreserve – you can then set the value to the static amount of memory that you want to reserve for the parent.

You should be warned – if you set this value too low; virtual machines will be able to use too much memory and cause performance issues for you.  Equally – the higher you set this the fewer virtual machines you can run.

That said – I have found this to be very useful on my laptop – where I use Hyper-V like a desktop operating system.  By setting this value to 2048 (on my laptop with 8GB of RAM) I can run multiple virtual machines and know that they will not cause Outlook / Internet Explorer in the parent partition to be affected.

Cheers,
Ben