Hyper-V pagefile sizing (Host and guests)

 Hi guys,

When you have a Hyper-V host with lots of memory installed on the host you don’t want the pagefile to be as big as the phycial RAM installed. Here’s a good “best practice” from Microsoft involving the use of pagefile on the Hyper-V host as well as the Hyper-V guests.


Paging File Configuration within the VM

clip_image001 Proper paging file configuration is vital to the way DM performs

clip_image001[1] DM requires that the VM have a PF

clip_image001[2] So how do you size your Paging File?

clip_image002 The old way doesn’t apply to DM:

  • Use Peak Commit Charge
  • Size PF to Peak Commit Charge – Physical Memory + some buffer

To understand how we should size the PageFile (PF), let’s consider an example:

clip_image001[4] Current Commit: 100 MB

clip_image003 Free Buffer: 20% (this is a new Dynamic Memory Setting)

clip_image003[1] Target Commit: 125 MB

clip_image003[2] Paging File: 1MB

clip_image003[3] Commit Limit: 126 MB

clip_image003[4] Available Memory: 26 MB (Commit Limit – Current Commit)

clip_image001[5] What happens when an app allocates 50 MB of memory?

clip_image003[5] What happens when an app allocates five 10 MB memory chunks?


clip_image001[6] Minimum PF should be large enough to cover the memory demands of your largest process. In the case of application allocating 50 MB of memory, the allocations request will fail with out of virtual memory error. When application allocates 10 MB chunks, the first two allocations will go through while the rest will fail as there’s no virtual memory (either RAM or PF) to accommodate that.

clip_image003[6] Maximum PF should be (peak commit charge – maximum physical memory + some buffer)

Paging File Configuration on the host

If you have reserved enough RAM for the host operations and your host is only being used for Hyper-V (plus Fail Over Cluster for HA VMs), you shouldn’t need a large pagefile.

With Dynamic Memory, you have to make sure that your host reserve is set properly

HKLMSOFTWAREMicrosoftWindows NTCurrentVersionVirtualization

Value Name: MemoryReserve

Value Type: DWORD

Value Data: (Decimal)Memory to reserve in MB

With a properly configured host reserve, if you follow (Peak Commit Charge – Physical Memory + some buffer) formula on the host, you’ll find out that you don’t need a page file.
So, Pagefile size of min= few Gigabyte and Max=2xmin should be sufficient.

Also, there are 2 new performance counter objects available to the Hyper-V host;

clip_image004 Hyper-V Dynamic Memory Balancer

    • Provides counters about the memory balancer running in the parent partition
    • Counters are focused on:
    • The memory that is available for the host to use
    • The add and remove operations performed by the memory balancer

clip_image004[5] Hyper-V Dynamic Memory VM

    • Provides counters about memory usage on the guest VMs that are currently running
    • Each VM has its own set of counters
    • Counters are focused on:
    • Memory added and removed from the guest
    • The memory pressure that the guest is experiencing

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.