Matthew Hodgkins in
Jul 13th, 2010 |
I was very excited with the announcement that Windows 2008 R2 Service Pack 1 would bring memory over-commit (dynamic memory) to Hyper-V, something that has been available in VMWare for a while now. Although I wouldn’t use this feature in a production environment (read this blog post for an explanation why: Memory over commitment, not for production servers), this new technology is perfect for use in the development and testing Hyper-V environment at SSW.
The explanation on how to setup Dynamic Memory In Windows 2008 R2 is below, but before you try it out – be aware that it is currently in Beta, and there is no word if you will be able to update to Service Pack 1 RTM, or if the Hyper-V integration components that need to be installed to use the Dynamic memory features can be upgraded. For this reason I recommend you only use “disposable” VM’s.
The Setup Process
- Downloaded the ISO from the Microsoft TechNet Evaluation Center
- Back up all of the development Hyper-V images from a Windows 2008 Hyper-V Server. I simply copied the .vhd files.
Note: In my environment, the server is an Intel Core2Quad with 8GB of DDR2 RAM
- (If required – in my case, the server only had Windows 2008) Reformat the server and installed Windows 2008 R2 Enterprise
- Install all available Windows Updates
- Run SSW Diagnostics to check for all green ticks (latest version of all software)
- Extract Service Pack 1 from the ISO file to the C:\ drive and ran setup.exe to begin the Service Pack 1 Beta installation.
After installing you will see Service Pack 1 Beta Installed - v.178
- (If required) Join the server to your separate Hyper-V domain and install the Hyper-V Server role.
Note: At SSW we have a separate Hyper-V domain which all of the Hyper-V servers are joined to. This allows all the Hyper-V servers to continue functioning and allows them to be managed in the case the primary domain was to go down.
- Open the Hyper-V Manager and click on New | Virtual Machine (I could have chosen to do an import / export, but I used this method as it was faster and the machines are very basic, just 1 drive and network adapter).Attach the old VHD file were backed up before the format. The Virtual Machine creation process is exactly the same with the new service pack.
- After the new virtual machine has been created, right click on it and click on Settings…
- In the settings for the Virtual Machine click on Memory
- This is where the changes have been made:
In the new Hyper-V Memory Options Screen We Now Have The 2nd "Dynamic" Option! Awesome!
- When you choose the Dynamic option, there are several settings which you will have to understand:
||This is the lowest amount of RAM that virtual machine needs to start up. For a Windows 7, Vista and Server 2008 this is 512mb. For Windows 2003 this is 128mb. This should be as low as possible for optimal memory utilization and potentially higher consolidation ratios.
||The maximum amount of memory the virtual machine is allowed to use. I recommend using the old static memory values from your VM’s for this.
- Memory Buffer (the first slider)
|Specifies how much memory Hyper-V will attempt to assign to the machine compared to the amount of memory that is actually needed. The memory buffer will not be maintained if there is not enough physical memory available in the computer. For example if this setting was 10%: A virtual machine has a maximum memory level of 2048mb, and it is actually needs 1000mb of RAM, Hyper-V will attempt to give this VM 1100mb of RAM (1000mb + 10%).
||Provides Hyper-V a way to determine how to distribute memory amount Virtual Machines if there is not enough physical memory available.
- These are the settings I used for my VM, as I want to get as many VM’s as possible on this development server:
The Changed Memory Settings for the Development VM. The Startup and Maxium RAM have been specified, and the buffer taken down to 5%
- To make use of the new dynamic memory features you need to install a new version of Integration Services. Start the VM and from the Action pane of the VM click Install Integration Services Setup Disk
- In the VM the CD auto run dialog should pop up. Install Integration Services then restart your VM.
- If you go back to the Hyper-V Manager you will notice 2 new columns that now have values in them:
||This is how much memory is currently allocated to this Virtual Machine. You will see this value change depending on how much memory the VM is using.
||The amount of memory allocated to the memory buffer, as a percentage of the committed memory in the virtual machine. This value can be negative. For example, a negative value is displayed when there is not enough available memory to give the virtual machine its buffer. A negative value also indicates that there is not enough available memory for Hyper-V to provide the virtual machine with as much memory as it currently needs. This value will not appear unless you install the new integration services
The new Current Memory & Memory Avaliable Columns
- Now for the best practices.
- Remember – only use disposable VM’s in the beta
- Use static memory first before installing integration components. After you have installed integration components, then switch to dynamic memory. If you don’t do this, your VM’s will only be able to use their Startup Memory until the integration components have been installed, which causes huge disk paging as the VM’s have to use their page file for their memory. This makes it EXTREAMLY slow to install integration components
Bad Example: VM's without the new integration compoents will need to page memory - leading to disk I/O problems
Good Example: The disk queue length is much better as the VM's aren't paging. Please note the change in scale between the 2 images - unfortunately this depends on the current values being read from the disk can't be changed in Resource Monitor.
Congratulations – you have installed and configured Hyper-V Dynamic memory.