Intelligent Automatic Pagefile Setting in Windows Server 2012 Hyper-V

UPDATED 10/8/2012

Pagefile

If you install Windows Server 2008 R2 with Hyper-V, the pagefile will be automatically managed, which usually has a 1:1 ratio with physical memory. However VM’s use their own pagefile and do not use the host paging mechanism. If you have lots of memory, chances are your pagefile will be way too big.

If we compare two servers with 16GB of memory each, one installed with Hyper-V R2 and the other installed with Windows Server 2012 Hyper-V we clearly see different numbers. Both servers have run for several days.

In the figure to the left you will see that Windows has 16GB allocated but recommends 24GB (1:1,5)
In the figure to the right you see that Windows Server 2012 is much more intelligent and allocates considerably less memory for paging. It is fairly consistent with the best practice in R2 to set a fixed maximum for the pagefile between 4 and 6GB.

imageimage

Although I haven’t found any best practices yet for the pagefile in Windows Server 2012 Hyper-V, this might suggest that you can use the autopilot for virtual memory in the latest server edition of Windows. Of course we need a little bit more experience in the field to really call this a best practice.

If you are looking for a very thorough blog on pagefile settings in R2, please visit this blog.

Here is another one on technet:
http://blogs.technet.com/b/mghazai/archive/2011/05/26/what-s-the-story-of-pagefile-size-on-hyper-v-servers.aspx

And finally a post about the Hyper-V Dynamic Memory and Host Memory Setting in R2:
http://blogs.technet.com/b/virtualpfe/archive/2011/08/29/hyper-v-dynamic-memory-and-host-memory-reserve-setting.aspx

Host Memory Reserve

The Host Memory Reserve, which reserves memory for the processes in the parent partition can be found in the following registry key:

Registry Key: HKLMSOFTWAREMicrosoftWindows NTCurrentVersionVirtualization
Value Name: MemoryReserve
Value Type: REG_DWORD

According to this post, the Host Memory in R2 is calculated in MB as follows: 384MB + (Memory in GB * 64)

So a 16GB host in R2 will have a default Host Memory Reserve of 384MB + (16 * 64) = 1.408MB

In two 16GB Windows Server 2012 hosts I looked at, the default Memory Reserve was 2048MB. We have to conclude that the formula used for Hyper-V R2 does not apply to Windows Server 2012.

image

I also looked at a Windows Server 2012 Hyper-V host with only 4GB which had a currently allocated pagefile size of 704MB and a recommended pagefile size of 3.582MB. This small host did not have a Host MemoryReserve entry at all, probably because a default 2GB Memory Reserve would be disproportional to the physical memory.

Update 10/8/2012

I had an interesting discussion about MemoryReserve with Michel Luescher who works for Microsoft Consultancy Services at Microsoft Schweiz. Michel is writing the chapters in Windows Server 2012 Hyper-V Installation and Configuration which deal with this subject.

IMPORTANT NOTE: Do not manually configure the Host MemoryReserve entry and leave this to Windows Server 2012 which will auto-configure this value on an as needed basis

In fact any newly installed Windows Server 2012 server with the Hyper-V role does not have a Host MemoryReserve entry in the registry and we still need to figure out under what circumstances this entry is added to the registry.

Take a look at Michel’s blog (German) on the subject:
http://www.server-talk.eu/2012/10/08/wie-viel-virtual-memory-braucht-ein-hyper-v-host-reloaded/

2 Comments

  1. October 10, 2012    

    Hi Hans

    in the old days the recommendation was to have the same setting for min and max pagefile size. Would you recommend to keep doing that today in Server 2012 hosts?
    The idea behind that optimization was to avoid having Windows grow and shrink the page file all the time…

  2. adminHans's Gravatar adminHans
    October 14, 2012    

    It wouldn’t hurt to make them the same.
    /hans

  1. http://www.hyper-v.nu/archives/hvredevoort/2012/10/intelligent-automatic-paging-file-setting-in-windows-server-2012-hyper-v/ « JC’s Blog-O-Gibberish on October 6, 2012 at 16:22

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">