Share via


Hyper-V Dynamic Memory Configuration Guide

Updated: February 16, 2011

Applies To: Microsoft Hyper-V Server 2008 R2, Windows Server 2008 R2 with SP1

What is Dynamic Memory?

Dynamic Memory is a new Hyper-V feature that helps you use physical memory more efficiently. With Dynamic Memory, Hyper-V treats memory as a shared resource that can be reallocated automatically among running virtual machines. Dynamic Memory adjusts the amount of memory available to a virtual machine, based on changes in memory demand and values that you specify. Dynamic Memory is available for Hyper-V in Windows Server 2008 R2 Service Pack 1 (SP1). You can make the Dynamic Memory feature available by applying the service pack to the Hyper-V role in Windows Server 2008 R2 or to Microsoft Hyper-V Server 2008 R2. For more information about installing the service pack, see Deployment Guide for Windows Server 2008 R2 with SP1 and Windows 7 with SP1 (https://go.microsoft.com/fwlink/?LinkId=192441).

What are the Benefits of Dynamic Memory?

Dynamic Memory helps you use memory resources more efficiently. Before this feature was introduced, changing the amount of memory available to a virtual machine could be done only when the virtual machine was turned off. With Dynamic Memory, Hyper-V can provide a virtual machine with more or less memory dynamically in response to changes in the amount of memory required by the workloads or applications running in the virtual machine. As a result, Hyper-V can distribute memory more efficiently among the running virtual machines configured with Dynamic Memory. Depending on factors such as workload, this efficiency can make it possible to run more virtual machines at the same time on one physical computer.

About this guide

This guide describes the requirements for Dynamic Memory and shows you how to configure this new feature. The guide assumes you have experience with using Hyper-V. For example, you have added the Hyper-V role, created a virtual machine, and installed an operating system, referred to as a guest operating system. If you are unfamiliar with these tasks, see the Hyper-V Getting Started Guide (https://go.microsoft.com/fwlink/?LinkId=196805) for instructions.

Requirements

To use Dynamic Memory, you will need the following:

  • A server running Hyper-V, with Windows Server 2008 R2 Service Pack 1 installed. For instructions about installing SP1, see Deployment Guide for Windows Server 2008 R2 with SP1 and Windows 7 with SP1 (https://go.microsoft.com/fwlink/?LinkId=192441).

  • Virtual machines running guest operating systems that support Dynamic Memory. To enable Dynamic Memory, a virtual machine must be running one of the guest operating systems and noted configurations identified in the following table.

    Guest operating system Editions Configuration requirements

    Windows Server 2008 R2

    Standard and Web editions

    Install Windows Server 2008 R2 SP 1 in the guest operating system.

    Windows Server 2008 R2

    Enterprise and Datacenter editions

    Do one of the following:

    • Install Windows Server 2008 R2 SP 1 in the guest operating system.

    • Upgrade the integration services in the guest operating system to the SP 1 version.

    Note
    Installing Windows Server 2008 R2 SP1 is the recommended method because it provides the added benefit of installing all updates included with SP1.

    Windows 7

    Ultimate and Enterprise editions (32-bit and 64-bit)

    Do one of the following:

    • Install Windows 7 SP1 in the guest operating system.

    • Upgrade the integration services in the guest operating system to the SP1 version.

    Note

    Installing SP1 is the recommended method because it provides the added benefit of installing all updates included with SP1.

    <p></p>
    </div></td>
    </tr>
    <tr class="even">
    <td><p>Windows Server 2008 with Service Pack 2 (SP2)</p></td>
    <td><p>Standard and Web editions (32-bit and 64-bit)</p></td>
    <td><p>Upgrade the integration services in the guest operating system to the SP1 version.</p>
    <p>Apply a hotfix as described in <a href="https://go.microsoft.com/fwlink/?linkid=206472">article 2230887</a> (https://go.microsoft.com/fwlink/?LinkId=206472).</p></td>
    </tr>
    <tr class="odd">
    <td><p>Windows Server 2008 with Service Pack 2 (SP2)</p></td>
    <td><p>Enterprise and Datacenter editions (32-bit and 64-bit)</p></td>
    <td><p>Upgrade the integration services in the guest operating system to the SP1 version.</p></td>
    </tr>
    <tr class="even">
    <td><p>Windows Vista with Service Pack 1 (SP1)</p></td>
    <td><p>Ultimate and Enterprise editions (32-bit and 64-bit)</p></td>
    <td><p>Upgrade the integration services in the guest operating system to the SP1 version.</p></td>
    </tr>
    <tr class="odd">
    <td><p>Windows Server 2003 R2 with Service Pack 2 (SP2)</p></td>
    <td><p>Standard, Web, Enterprise, and Datacenter editions (32-bit and 64-bit)</p></td>
    <td><p>Upgrade the integration services in the guest operating system to the SP1 version.</p></td>
    </tr>
    <tr class="even">
    <td><p>Windows Server 2003 with Service Pack 2</p></td>
    <td><p>Standard, Web, Enterprise, and Datacenter editions (32-bit and 64-bit)</p></td>
    <td><p>Upgrade the integration services in the guest operating system to the SP1 version.</p></td>
    </tr>
    </tbody>
    </table>
    

    Note

    The procedures in this guide require you to use an account that is a member of the Administrators group.

    Upgrade and Compatibility Considerations

    Use of Dynamic Memory introduces changes to the configuration of a virtual machine that affect its compatibility with servers running earlier versions of Hyper-V. These compatibility issues also exist if a virtual machine is configured to use Microsoft RemoteFX, which is also a new feature introduced in SP1. For information about these considerations, see Deployment Guide for Windows Server 2008 R2 with SP1 and Windows 7 with SP1 (https://go.microsoft.com/fwlink/?LinkId=192441).

    About the Dynamic Memory Settings

    Four new virtual machine settings in Hyper-V Manager allow you to configure Dynamic Memory. Review the following descriptions to understand how the features work and how they are related. (Instructions on configuring these settings are presented later in this guide, in “Step 3: Configure Dynamic Memory.”)

    Setting Description

    Startup RAM

    Specifies the amount of memory required to start the virtual machine. The value needs to be high enough to allow the guest operating system to start, but should be as low as possible to allow for optimal memory utilization and potentially higher consolidation ratios.

    Maximum RAM

    Specifies the maximum amount of memory that this virtual machine is allowed to use. The value can be set from as low as the value for Startup RAM to as high as 64 GB. However, a virtual machine can use only as much memory as the maximum amount supported by the guest operating system. For example, if you specify 64 GB for a virtual machine running a guest operating system that supports a maximum of 32 GB, the virtual machine cannot use more than 32 GB.

    Memory buffer

    Specifies how much memory Hyper-V will attempt to assign to the virtual machine compared to the amount of memory actually needed by the applications and services running inside the virtual machine. Memory buffer is specified as a percentage because the actual amount of memory that represents the buffer changes in response to changes in memory usage while the virtual machine is running. Hyper-V uses performance counters in the virtual machine that identify committed memory to determine the current memory requirements of the virtual machine and then calculates the amount of memory to add as a buffer. The buffer is determined using the following formula:

    Amount of memory buffer = how much memory the virtual machine actually needs / (memory buffer value / 100).

    For example, if the memory committed to the guest operating system is 1000 MB and the memory buffer is 20%, Hyper-V will attempt to allocate an additional 20% (200 MB) for a total of 1200 MB of physical memory allocated to the virtual machine.

    Note
    The buffer is not maintained when there is not enough physical memory available in the computer to give every virtual machine its requested memory buffer.

    Memory weight

    Provides Hyper-V with a way to determine how to distribute memory among virtual machines if there is not enough physical memory available in the computer to give every virtual machine its requested amount of memory.

    Note

    You can change RAM amounts only when the virtual machine is off, but you can change the buffer and weight at any point.

    Steps to configure Dynamic Memory

    1. Identify and prepare the virtual machines.

    2. Identify the memory consumption of a virtual machine.

    3. Configure Dynamic Memory settings.

    4. Evaluate and compare performance measurements.

    Step 1: Identify and prepare the virtual machines

    Choose the virtual machines that you will use to evaluate Dynamic Memory, keeping in mind that the guest operating system must support Dynamic Memory. All of the guest operating systems listed in the “Requirements” section satisfy this condition. You can use existing virtual machines that run one of those operating systems, create new virtual machines, or use a combination of new and existing virtual machines. For instructions on creating a virtual machine, see the Hyper-V Getting Started Guide (https://go.microsoft.com/fwlink/?LinkId=196805).

    After you choose the virtual machines, prepare each virtual machine by installing a driver in the guest operating system. The steps required to install the driver differ among the various guest operating systems:

    • For Windows Server 2008 R2 Standard Edition and Windows Server 2008 R2 Web Edition, apply the service pack to the guest operating system instead of upgrading the integration services.

    • For Windows Server 2008 with SP2 Standard Edition and Windows Server 2008 with SP2 Web Edition, apply a hotfix as described in article 2230887(https://go.microsoft.com/fwlink/?LinkId=206472). Then, use the following instructions to upgrade the integration services.

    • For Windows 7, you can apply the service pack instead of performing the following procedure to upgrade the integration services. Installing SP1 is the recommended method because it provides the added benefit of installing all updates included with SP1.

    • For Windows Vista, Windows Server 2003 R2, and Windows Server 2003, use the following instructions to upgrade the integration services.

    Upgrade integration services

    1. If the virtual machine is not running, turn on the virtual machine.

    2. Connect to the virtual machine. From Hyper-V Manager, right-click the virtual machine and click Connect.

    3. Log on to the guest operating system with an account that is a member of the Administrators group.

    4. From the Action menu of Virtual Machine Connection, click Insert Integration Services Setup Disk.

    5. If Setup doesn’t start automatically, navigate to the CD/DVD drive in the guest operating system and start Setup manually. (For example, navigate to D:\support\<architecture>\setup, where <architecture> is either amd64 or x86.)

    6. Click OK when prompted to upgrade or repair integration services.

    7. Restart the virtual machine.

    Step 2: Identify the memory consumption of a virtual machine

    To determine how much memory a virtual machine consumes when Dynamic Memory is not enabled, simply review the amount of memory that is configured for the virtual machine. When the virtual machine is paused or running and Dynamic Memory is not enabled, this amount of physical memory is available exclusively to the virtual machine. This memory is referred to as static memory because the amount stays the same regardless of fluctuations in memory demands. No other virtual machine can use this memory unless this virtual machine is turned off.

    To identify the memory consumption of a virtual machine

    1. Open the settings window for the virtual machine. From Hyper-V Manager, right-click the virtual machine and click Settings.

    2. In the left pane, under Hardware, click Memory.

    3. On the Memory page, under Memory Management, review the amount of RAM listed under Static.

    Step 3: Configure Dynamic Memory

    To configure Dynamic Memory, perform the following steps.

    To configure Dynamic Memory

    1. Shut down each virtual machine that you want to enable Dynamic Memory on.

    2. Open the settings window for each virtual machine. From Hyper-V Manager, right-click the virtual machine and click Settings.

    3. In the left pane, under Hardware, click Memory.

    4. On the Memory page, under Memory Management, click Dynamic.

    5. Set the amount of memory for Startup RAM and Maximum RAM. For Startup RAM, refer to the table in the Appendix to determine the appropriate value. For Maximum RAM, use a value that allows for additional memory as needed but not more than what you would want the virtual machine to consume.

    6. If you want to adjust the memory buffer for the virtual machine, use the slider to set the percentage of memory.

    7. If you want to give this virtual machine a higher or lower priority for memory allocation compared to other virtual machines running on this server, use the slider to set the relative weight.

    8. Turn on the virtual machine.

    9. If the guest operating system is Windows 7, log on to the guest operating system again to complete the configuration.

    Step 4: Evaluate Memory Consumption

    After Dynamic Memory is enabled on a virtual machine, the amount of memory allocated to the virtual machine changes in response to demand. There are two basic ways you can evaluate how the memory consumption of a virtual machine changes when it is configured to use Dynamic Memory:

    • You can see current information by reviewing the Details pane of Hyper-V Manager.

    • You can add performance counters and monitor them to see how the memory consumption changes over a specific time period.

    Both of these methods are described in the following steps.

    Step 4a: Review changes in real time in Hyper-V Manager

    After you apply SP1 to a server running Hyper-V, three new columns appear in the Virtual Machines pane of Hyper-V Manager. You can use these columns to view current information, as well as watch them to see how the values change as various operations are performed.

    • Assigned Memory shows how much physical memory is allocated to the virtual machine at this time.

    • The Memory Demand column shows how much memory the virtual machine needs at this time to meet the requirements of the active processes running in the virtual machine. This amount represented the total committed memory based on data obtained from performance counters.

    • Memory Status shows how much of the buffer amount specified for the virtual machine is available to the virtual machine at this time. Status is reported as one of the following:

      • OK indicates that there is enough physical memory available to give the virtual machine the full amount of memory buffer.

      • Low indicates that the current amount of memory assigned to the virtual machine as a buffer is lower than amount that Hyper-V determines should be available as a buffer.

      • Warning indicates that there is not enough physical memory available to assign any memory buffer to the virtual machine.

    Step 4b: Use performance counters to monitor memory allocation

    SP1 includes new Hyper-V performance counters that monitor how memory is allocated to virtual machines enabled with Dynamic Memory. The new performance counters are included in two new Hyper-V performance counter groups: Hyper-V Dynamic Memory Balancer and Hyper-V Dynamic Memory VM. You can use the performance counters in these groups to create Data Collector Sets, which you can use to capture and analyze data collected by the performance counters. For example, you can schedule repeated collection of a Data Collector Set to create logs, load it in Performance Monitor to see the data in real time, and save it as a template to use on other computers.

    To create a Data Collector Set to monitor memory allocation

    1. Start Performance Monitor and add one or more of the new performance counters.

      1. Click Start, right-click Computer, and click Manage. In the Microsoft Management Console navigation tree, click Reliability and Performance.

      2. In the navigation tree, expand Reliability and Performance, expand Monitoring Tools, and click Performance Monitor.

      3. In the menu bar above the Performance Monitor graph display, either click the Add button (+) or right-click anywhere in the graph and click Add counters from the menu. The Add Counters dialog box opens.

      4. In the Available Counters section, scroll through the list to find Hyper-V Dynamic Memory VM and then click the plus (+) sign to expand the group. Select one or more counters from this group, such as Current Pressure and Guest Visible Physical Memory, and then click Add. Click OK to close the dialog box.

    2. Right-click anywhere in the Performance Monitor display pane, point to New, and click Data Collector Set. The Create New Data Collector Set Wizard starts. The Data Collector Set created will contain all of the data collectors selected in the current Performance Monitor view.

    3. Type a name for your Data Collector Set and click Next.

    4. The Root Directory will contain data collected by the Data Collector Set. Change this setting if you want to store your Data Collector Set data in a different location than the default. Browse to and select the directory, or type the directory name.

    Note

    If you enter the directory name manually, you must not enter a back slash at the end of the directory name.

    1. Click Next to define a user for the Data Collector Set to run as, or click Finish to save the current settings and exit.

    For more information about using Data Collector Sets, see “Scenario 3: Create a Data Collector Set from Performance Monitor” in the Performance and Reliability Monitoring Step-by-Step Guide for Windows Server (https://go.microsoft.com/fwlink/?LinkId=196705).

    Troubleshooting

    Real-time memory information does not appear in Hyper-V Manager

    If the memory columns in the Details pane of Hyper-V Manager are blank for a running virtual machine enabled with Dynamic Memory, check the following:

    • Review the “Requirements” section in this guide to verify that the guest operating system supports Dynamic Memory. Then, verify that the guest operating system has been configured correctly. For example, integration services have been upgraded or the service pack has been applied.

    • If you enabled Dynamic Memory before performing all of the required configuration, restart the virtual machine.

    The virtual machine uses too much memory

    If a virtual machine with Dynamic Memory enabled appears to use too much memory, or does not release memory when the physical computer does not have enough available memory, you can limit the amount of memory used by the virtual machine by setting a lower value for the Maximum RAM setting.

    You may notice that the amount of RAM reported by Task Manager in the guest operating system does not decrease when a virtual machine uses less RAM. This occurs because the driver reports the maximum amount of memory that the guest operating system has used since it was started.

    Performance is unsatisfactory

    After you enable Dynamic Memory on a virtual machine, if you are not satisfied with the performance, making one or more of the following configuration changes may improve performance.

    • Increase the size of the page file in the guest operating system. A bigger page file allows larger amounts of memory to be added to the running virtual machine if it is needed suddenly. This also improves performance when the availability of physical memory is limited.

    • Increase the memory buffer configured for the virtual machine. When a bigger memory buffer exists, more memory is assigned to the virtual machine compared to the amount of memory required by the applications and services running in the virtual machine. This extra memory can be used for file caching, and might help with improve performance of I/O-intensive applications and services.

    • Increase the Startup RAM for the virtual machine. Some applications assign fixed amounts of memory based on the amount of memory available when the application starts. These applications perform better with higher values for the Startup RAM. Alternatively, if poor performance is the result of too much memory being removed from the virtual machine, increasing the value of the Startup RAM might also fix this problem.

    Note

    Increasing the value for Startup RAM reduces the overall flexibility and effectiveness of Dynamic Memory.

    • Increase the memory weight of the virtual machine. Hyper-V will assign available physical memory to this virtual machine before assign it to virtual machines with a lower memory weight.

    The amount of memory does not increase

    On a virtual machine with Dynamic Memory enabled, if the amount of memory does not increase, check the following:

    • Compare the Maximum RAM value to the Assigned Memory value to see whether the virtual machine is running at the maximum amount of memory.

    • Check for available space on the physical disk where the virtual machine resides. (The default location is C:\ProgramData\Microsoft\Windows\Hyper-V.) Dynamic Memory increases the size of saved state files as memory is added to the virtual machine.

    Available memory is too low in the management operating system

    Hyper-V automatically calculates an amount of memory to reserve for exclusive use by the management operating system. This memory is used to run virtualization services. If the computer is part of a failover cluster, Hyper-V also reserves enough memory to run the failover cluster services. However, if the management operating system rums other roles or features, the amount of reserved memory might be too low. You can specify a larger amount of memory by modifying the registry.

    Warning

    Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

    1. Click Start, click in the Start Search box, type regedit and press ENTER.

    2. If the User Account Control box appears, click Yes.

    3. In the navigation tree, expand HK_LOCAL_MACHINE, expand SOFTWARE, expand MICROSOFT, expand WINDOWS NT, and then expand CurrentVersion.

    4. Right-click Virtualization, point to New, and click DWORD.

    5. Name the new value MemoryReserve.

    6. Right-click MemoryReserve and click Modify. Under Value data, set the value to the amount of memory you want to reserve.

    The guest operating system does not create a full memory dump file

    The page file must be large enough to store the dump file. When Dynamic Memory is enabled, the guest operating system uses the value of the startup memory configured for the virtual machine to determine the size of the page file. To ensure that the page file is large enough to store a full memory dump file, set the size of the page file to the maximum memory configured for the virtual machine.

    Appendix: Memory Settings

    The following table lists the recommended Startup RAM for supported guest operating systems when Dynamic Memory is enabled.

    Guest Operating System Startup RAM

    Windows Server 2008 R2 Enterprise Edition

    512 MB

    Windows Server 2008 R2 Datacenter Edition

    512 MB

    Windows 7 Ultimate Edition

    512 MB

    Windows 7 Enterprise Edition

    512 MB

    Windows Server 2008 Enterprise Edition

    512 MB

    Windows Server 2008 Datacenter Edition

    512 MB

    Windows Vista Ultimate Edition

    512 MB

    Windows Vista Enterprise Edition

    512 MB

    Windows Server 2003 R2 Enterprise Edition

    128 MB

    Windows Server 2003 R2 Datacenter Edition

    128 MB

    Windows Server 2003 Enterprise Edition

    128 MB

    Windows Server 2003 Datacenter Edition

    128 MB