Virtualization changes the way IT admins assign memory. With methods like virtual memory management, admins can allocate additional memory to a virtual machine (VM) that has run out of resources. Such virtualization management tactics can improve VM performance and management flexibility.
Dynamic Memory makes virtual memory allocation the hypervisor's responsibility, instead of yours.
Until recently, Microsoft's Hyper-V virtualization posed limitations for memory allocation because it failed to address a common conundrum for administrators: How much memory should they assign to a particular VM?
The new Hyper-V Dynamic Memory feature, which was introduced in the upcoming Hyper-V R2 Service Pack 1 release, relieves admins of this guesswork. Dynamic Memory pools all available memory on a physical host and dynamically distributes it to virtual machines running on that host as necessary. By automatically assigning the amount of memory needed to virtual machines, Hyper-V VMs can run more efficiently and flexibly.
Hyper-V Dynamic Memory vs. VMware memory overcommit
Hyper-V Dynamic Memory is not the first feature to address this problem. But VMware has a different approach to virtual memory allocation from Microsoft's.
VMware's memory ballooning and memory overcommit features also take the guesswork out of virtual memory allocation. In a VMware infrastructure, these technologies also enable you to assign a quantity of memory to a VM. Once powered on, the host reassigns unused memory to other VMs. Everyone wins, because the host automatically reassigns memory wherever it's needed.
While an entirely workable solution, VMware's virtual memory allocation suffers from an important limitation: You still must assign some amount of memory to that VMware host. And that process is just a guess. Consequently, many administrators still go by an old rule of thumb that precedes virtualization: Just add 4 GB of RAM to every server. But with Hyper-V Dynamic Memory, you can allocate memory with much more precision.
Why use Hyper-V Dynamic Memory?
Microsoft takes a fundamentally different approach to assigning memory to VMs. Here's how it works:
In Hyper-V R2 SP1, you have one of two options for virtual memory allocation. Option one represents the "old" way: You assign a static quantity of memory that's reserved for a specific VM -- nothing new there.
Option two does away with the static method. Hyper-V Dynamic Memory makes virtual memory allocation the hypervisor's responsibility instead of yours, and it does so on a moment-by-moment basis. Sound scary? It's actually quite compelling.
Here's why: IT professionals have always been forced to guess how much RAM should be put into a server. But the kernel always knows the amount of memory needed for a specific task and a specific moment. This inside-the-computer instrumentation is a pretty good indicator of how much RAM a server needs, and Microsoft has simply extended the capability ever so slightly. Now, Hyper-V Dynamic Memory just tells the host what the memory value is -- and does so every second, according to Microsoft.
Checks and balances for Hyper-V Dynamic Memory
Obviously the hypervisor's allocation activity needs a set of constraints that let you maintain control while Hyper-V does most of the work. Microsoft allows you to configure control settings when you enable Hyper-V Dynamic Memory. The constraints are Startup RAM and Maximum RAM, and you can configure both in the properties of each VM.
- Startup RAM. This setting requires that you give Hyper-V a starting value to assign to a booting VM. Before that VM powers on and can communicate with the Hyper-V host, it can provide no data about how much memory it needs.
- Startup RAM is 512MB by default, and you should generally leave it at this setting. Remember that this value is only what's needed to get the VM booted -- and not much more. Hyper-V will take it from there.
- Maximum RAM. This setting limits the amount of memory a VM can use. Maximum RAM is set by default to 65,536 MB of RAM, and you should generally leave it at this setting. Providing each VM with this huge capacity gives the host the greatest flexibility for distributing memory to whichever VMs need it most.
There is a scenario in which you may need to reduce the Maximum RAM value: when a VM consumes every bit of memory it's provided. This problem may occur when a process is a memory hog or when a user's desktop won't stop opening applications. This control setting protects you from VMs that don't play fair, so to speak. You can also use it to limit memory on VMs used by a group of users or applications that could end up consuming all the RAM in the box.
In all other cases, a single radio button turns on Hyper-V Dynamic Memory. Once enabled, you can set controls as you wish. Then you can happily leave Hyper-V to deal with its own virtual memory allocation, freeing you from one of IT's greatest pieces of hardware guesswork.
Greg Shields is an independent author, instructor, Microsoft MVP and IT consultant based in Denver. He is a co-founder of Concentrated Technology LLC and has nearly 15 years of experience in IT architecture and enterprise administration. Shields specializes in Microsoft administration, systems management and monitoring, and virtualization. He is the author of several books, including Windows Server 2008: What's New/What's Changed, available from Sapien Press.