Service Pack 1 for Windows 7 and Windows 2008 R2 released to the public and they are in the wild. Perhaps the most interesting and sought after aspect is Dynamic Memory for Hyper-V.
This post sheds some limelight on a whitepaper and extracts some key aspects. The document can be found here:
Download Windows 7 and Windows Server 2008 R2 Service Pack 1 (SP1) Beta
Dynamic Memory is a new feature of Hyper-V™ introduced in Service Pack 1 for Windows Server® 2008 R2 that enables Hyper-V hosts to dynamically adjust the amount of memory available to virtual machines in response to changing workloads. The benefits of Dynamic Memory include higher virtual machine consolidation ratios and increased flexibility for managing virtualized workloads. This blog draws heavily from the released whitepapers and my own experience. summarizes how Dynamic Memory works, requirements for implementing Dynamic Memory, how to enable and configure Dynamic Memory, and some considerations and best practices for implementing Dynamic Memory.
Understanding Dynamic Memory
Hyper-V in Windows Server 2008 and Windows Server 2008 R2 employed a static memory model where the administrator of a Hyper-V host would assign the amount of physical memory for each virtual machine on the host. Then when a virtual machine is started on the host, the assigned memory is allocated to the virtual machine and never changes unless the virtual machine is shut down and a different amount of memory is assigned to it. For Microsoft customers who want to achieve higher virtual machine consolidation ratios for server consolidation or VDI scenarios, the static memory model of Hyper-V on these earlier platforms becomes a limiting factor. To meet the needs of such customers, Microsoft is introducing a new feature called Dynamic Memory in Service Pack 1 for Windows Server 2008 R2.
How Dynamic Memory Works
At a high level, Dynamic Memory works by pooling together all physical memory on the host, minus a certain amount of memory that’s reserved for exclusive use by the parent partition. Memory from this pool is then securely distributed among virtual machines running on the host, while the amount of memory allocated to a particular virtual machine dynamically adjusts in real time based on the needs of the virtual machine.
Understanding Memory Pressure and Memory Buffer
Dynamic Memory determines the amount of memory needed by a virtual machine by calculating something called memory pressure. To perform this calculation, Hyper-V looks at the total committed memory of the guest operating system running in the virtual machine and then calculates pressure as the ratio of how much memory the virtual machine wants to how much it has. The amount of memory that Hyper-V then assigns to the virtual machine equals total committed memory plus some additional memory to be used as a buffer. This additional amount of memory is configurable on a per-virtual machine basis as a percentage amount. For example, configuring a buffer value of 50% means that an additional memory of up to 50% of committed memory can be allocated to the virtual machine. The guest operating system of the virtual machine typically uses this additional memory for its system file cache to boost the performance of the operating system and applications.
Dynamic Memory Requirements
Dynamic Memory has requirements on both the host side and the guest operating system side. The following sections summarize these requirements for the beta release of Service Pack 1.
Host Requirements for Dynamic Memory
In order to be able to use the Dynamic Memory feature on a Hyper-V host, Service Pack 1 must be applied to one of the following virtualization platforms:
· Windows Server 2008 R2 with the Hyper-V server role installed
· Microsoft Hyper-V Server 2008 R2
Guest Requirements for Dynamic Memory
The following Windows server operating systems support Dynamic Memory when installed as the guest operating system on a virtual machine:
· Windows Server 2008 R2 Standard Edition SP1*
· Windows Server 2008 R2 Enterprise Edition SP1
· Windows Server 2008 R2 Datacenter Edition SP1
· Windows Server 2008 R2 Web Edition SP1*
· Windows Server 2008 Standard Edition SP2*
· Windows Server 2008 Enterprise Edition SP2
· Windows Server 2008 Datacenter Edition SP2
· Windows Server 2008 Web Edition SP2*
· Windows Server 2003 R2 Standard Edition SP2 or higher*
· Windows Server 2003 R2 Enterprise Edition SP2 or higher
· Windows Server 2003 R2 Datacenter Edition SP2 or higher
· Windows Server 2003 R2 Web Edition SP2 or higher*
· Windows Server 2003 Standard Edition SP2 or higher*
· Windows Server 2003 Enterprise Edition SP2 or higher
· Windows Server 2003 Datacenter Edition SP2 or higher
· Windows Server 2003 Web Edition SP2 or higher*
Note: The Beta release of Service Pack 1 does not support Dynamic Memory for the operating systems marked with an asterisk (*) above. However, support for Dynamic Memory for these operating systems will be added in a future release of SP1.
Note: Dynamic Memory is supported for both the x86 and x64 architectures of Windows Server 2003, Windows Server 2003 R2 and Windows Server 2008.
The following Windows client operating systems for both x86 and x64 architecture also support Dynamic Memory when installed as the guest operating system on a virtual machine:
· Windows® 7 Enterprise Edition
· Windows 7 Ultimate Edition
· Windows Vista® Enterprise Edition SP2
· Windows Vista Ultimate Edition SP2
High Level Steps for Enabling and Configuring Dynamic Memory
Enabling and configuring Dynamic Memory on a virtual machine involves the following steps:
· Upgrading Integration Components
· Enabling Dynamic Memory
· Configuring Startup RAM
· Configuring Maximum RAM
· Configuring Memory Buffer
· Configuring Memory Priority
The sections that follow provide more information concerning each of these steps.
Enabling Dynamic Memory
To enable Dynamic Memory on a virtual machine, you must first shut down the virtual machine. Note that shutting down a virtual machine may result in service interruption for applications or users who access the virtual machine. Once the virtual machine is turned off, you can enable and configure Dynamic Memory by opening the Settings for the virtual machine and selecting Memory under Hardware as shown in Figure 1:
Figure 1: Enabling and configuring Dynamic Memory on a virtual machine.
To enable Dynamic Memory on the virtual machine, change the Memory Management setting from Static to Enabled. If desired you can later disable Dynamic Memory on the machine by changing the setting back to Static to specify that a fixed amount of memory be used by the machine. Note that you can have a mix of different virtual machines on the same Hyper-V R2 SP1 with some virtual machines having Dynamic Memory enabled on them and other virtual machines having fixed amounts of memory assigned to them.
Once you have enabled Dynamic Memory on a virtual machine, you need to configure the Startup RAM, Maximum RAM, Memory Buffer and Memory Priority for the virtual machine. These settings are discussed next in the sections below. To configure Startup RAM or Maximum RAM, you must first shut down the virtual machine which may result in service interruption for applications or users who access the virtual machine. Memory Buffer and Memory Priority however can be configured even when the virtual machine is running.
Three Scenarios possible Scenarios to use Dynamic Memory
Desktop Virtualization – 1
In many scenarios Desktops under utilize memory. Therefore not having Dynamic Memory was a real limitation because you had to fully allocate memory to systems which might not have been utilized.
Server Consolidation – 2
Legacy servers may only require their full memory load sporadically. It might be that when the workload is required you need a substantial amount of memory. In this type of scenario you can keep the server running and ready while maintaining the density of your server farm.
Dynamic Data Centers – 3
As System Center Virtual Machine Manager shifts your work loads around the server farm its ability to computer the best servers to run your work load will profit from Dynamic Memory. This will allow greater density, better overall ROI and lower over all utility costs. This will be done by using staging servers in densely over committed server environment and using live Migration to move servers to ‘Free Run’ hosts which have only server workloads which require greater memory flexibility.
Planning for Failure – 1
When planning for Dynamic Memory implementations never forget about what happens when you loose a host server. The greater density does not reduce the requirement to have additional servers available even at maximum load which will be available to maintain High Availability requirements.
Design for Memory – 2
Memory is the key design constraint. The best designs understand this and work to detach the requirement for storage from the requirement for memory.
Generally keep on your toes – 3
As you read back through my blog about Hyper-V and R2 you will find that I have stumbled on gotchas in evaluating betas in this area. Remember to do your traditional back ups and don’t forget to back up your configurations of SCVMM and the rest of the environment.
VMM Support for Dynamic Memory
Dynamic Memory support is coming in VMM. With the first release of SP1 to the wild it was easy to spot the need for Dynamic Memory as a management feature requirement in System Center Virtual Machine Manager. A natural question and Michael Michael from Microsoft make this statement “a future update to VMM will support Dynamic Memory.”
Try not to configure too high a value for the Startup RAM setting on a virtual machine. The reason is because Dynamic Memory as implemented in Hyper-V R2 SP1 can never decrease the memory allocated to the virtual machine below the value of the Startup RAM setting. The Dynamic Memory algorithm will always strive to make this minimum amount of memory available to the virtual machine.
Dynamic memory is a must have feature for increasing density. Used cautiously and wisely it will greatly increase your data center density while giving you greater flexibility.
I have tried to capture the highlights of the documentation regarding Dynamics Memory in Windows 2008 R2 SP1 which has reached the Public Bata stage. I have also provided links to the documents which are the source of this information. Finally you will find some design guidance and gotchas from the field.