Home > Cloud, Hyper-V, Microsoft, SCVMM R2, Virtualization, Windows 2008 R2 > Tuning Windows 2008 R2 SP1 dynamic memory for best performance

Tuning Windows 2008 R2 SP1 dynamic memory for best performance

What is Dynamic Memory?

Dynamic memory overview

Dynamic memory allows you to configure a virtual machine so that the amount of memory assigned to the virtual machine is adjusted while the virtual machine is running, in reaction to the amount of memory that is actually being used by the virtual machine.  This allows you to run a higher number of virtual machines on a given physical computer.  It also ensures that memory is always distributed optimally between running virtual machines.

Before enabling dynamic memory in a virtual machine you need to ensure that the latest version of integration services is installed in the virtual machine.You can then enable dynamic memory for a virtual machine using the memory settings under the virtual machine settings.  Once dynamic memory is enabled there are four parameters that you can configure:

  • Initial memory.
    This is the amount of memory that is required to start the virtual machine.  This value needs to be high enough to allow the guest operating system to boot, but should be as low as possible to allow for optimal performance with dynamic memory.The virtual machine will never be assigned less memory than the initial memory value.
  • Maximum memory.
    The virtual machine will not be allowed to use more memory than is specified by this value.  This value can be configured anywhere from the initial memory value up to 64GB.
  • Memory buffer.
    The memory buffer value indicates how much memory is assigned to the virtual machine when compared to the amount of memory actually needed by the applications and services running inside the virtual machine.
    The memory buffer will not be maintained if there is not enough physical memory available in the computer to give every virtual machine its requested memory buffer.
  • Memory priority.
    The memory priority value reflects how memory will be distributed amongst virtual machines if there is not enough physical memory available in the computer to give every virtual machine its requested amount of memory.
    Higher priority virtual machines will be given more memory when compared to lower priority virtual machines with similar settings.

Supported guest operating systems

Dynamic memory is supported for the following guest operating systems:

  • Windows Server 2008 R2 Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2008 R2 Datacenter Edition (32-bit and 64-bit)
  • Windows 7 Ultimate Edition (32-bit and 64-bit)
  • Windows 7 Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2008 Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2008 Datacenter Edition (32-bit and 64-bit)
  • Windows Vista Ultimate Edition (32-bit and 64-bit)
  • Windows Vista Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2003 R2 Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2003 R2 Datacenter Edition (32-bit and 64-bit)
  • Windows Server 2003 Enterprise Edition (32-bit and 64-bit)
  • Windows Server 2003 Datacenter Edition (32-bit and 64-bit)

If you enable dynamic memory for a virtual machine that is running an operating system that is not on this list, the guest operating system will only be able to access the initial memory.

For each supported operating system you should follow the published required and recommended memory values prior to installing the latest integration services and enabling dynamic memory.  Once dynamic memory is enabled you can use a lower initial value in order to get the best performance out of dynamic memory.  The maximum memory value should always be greater than the required memory for the operating system that is running in the virtual machine.

Operating System Required Memory Recommended Memory Initial Memory (with DM enabled)
Windows Server 2008 R2 Enterprise Edition 512MB N/A 512MB
Windows Server 2008 R2 Datacenter Edition 512MB N/A 512MB
Windows 7 Ultimate Edition 1GB N/A 512MB
Windows 7 Enterprise Edition 1GB N/A 512MB
Windows Server 2008 Enterprise Edition 512MB 1GB 512MB
Windows Server 2008 Datacenter Edition 512MB 1GB 512MB
Windows Vista Ultimate Edition 512MB 1GB 512MB
Windows Vista Enterprise Edition 512MB 1GB 512MB
Windows Server 2003 R2 Enterprise Edition 128MB 256MB 128MB
Windows Server 2003 R2 Datacenter Edition 512MB 1GB 128MB
Windows Server 2003 Enterprise Edition 128MB 256MB 128MB
Windows Server 2003 Datacenter Edition 512MB 1GB 128MB

Tuning dynamic memory for best performance

If you enable dynamic memory on a virtual machine and are not satisfied with the performance that you receive from the virtual machine, there are multiple configuration changes that you can make to potentially improve performance:

  • Increase the size of the page file inside the guest operating system.
    A larger page file inside the virtual machine allows larger amounts of memory to be added to the running virtual machine if it is needed suddenly.  It also lets the virtual machine run better when the availability of physical memory is limited.
  • Increase the memory buffer configured for the virtual machine.
    Increasing the memory buffer will result in more memory being assigned to the virtual machine when compared to the amount of memory actually needed by the applications and services running inside the virtual machine.  This extra memory can then be used for file caching purposes, and may help with the performance of IO intensive applications and services.
  • Increase the initial memory for the virtual machine.
    Some applications assign fixed amounts of memory based on the amount of memory available when the application first starts.  These applications will perform better with higher values for the initial memory.
    Alternatively, if you are seeing poor performance due to too much memory being removed from the virtual machine, increasing the initial memory value can also alleviate this problem.
    It should be noted that by increasing the initial memory value, the overall flexibility and effectiveness of dynamic memory is reduced.
  • Host Reservation

Virtual Machines with Dynamic Memory enabled could consume all memory on the host, leaving nothing for the parent partition.  That’s why we have a new registry key:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ Virtualization
  • REG_DWORD value
  • Name = MemoryReserve
  • Setting = amount of MB to reserve for the parent partition, e.g. 2GB RAM.

You must reboot the host after setting this registry value.

Increase the virtual machine memory priority.
Increasing the virtual machine memory priority will ensure that available physical memory is assigned to this virtual machine before being

Source: Windows Server 2008 R2 and Windows 7 Service Pack 1 Test Focus Guide

Updated with Host Reservation

Advertisements
  1. Than
  2. February 9, 2011 at 11:53 am

    great blog a good read will search for more blogs like this

  1. July 26, 2010 at 12:47 pm
  2. November 23, 2010 at 11:12 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: