[TechTarget China original] Dynamic memory (Dynamic memory) is Microsoft's effort to address common problems in Virtualization: how to effectively allocate memory to virtual machines that do not always need it.
Memory has always been the first key resource to be used up. As a result, a lack of memory is the origin of a low consolidation rate. The pressure also comes from some application owners who demand as much memory as possible for the application, even if they do not need to allocate the amount of memory they need.
Ideally, users can allocate a large amount of memory and use it as needed. Sometimes Hyper-V is not like this: if a virtual machine allocates 4 GB of memory when it is started, it occupies 4 GB of memory no matter what it needs, it will not return the memory to Hyper-V before the VM is shut down. This will inevitably lead to a lower consolidation rate than Microsoft's competitors, which also makes it difficult to effectively allocate memory.
With the release of Hyper-V R2 SP1, Microsoft has added dynamic memory support, which is very different from the memory overuse (memory over-commitment) in its main competing product VMware ESX. Microsoft claims for a long time that it is dangerous for the virtual machine to take over the physical memory, because all these virtual machines may need to be allocated at the same time. Whether this is true or not, we generally use over-subscribe in other IT fields, such as storage. Microsoft's position is applied in the Microsoft community.
The dynamic memory essentially balances the management system functions of the guest operating system to achieve its goal. It relies mainly on the capacity of most modern servers and operating systems for real-time memory addition and removal. Dynamic Memory carries this function, allowing Hyper-V to add or remove memory on the virtual machine when it is running. Once the server is started, Hyper-V displays a pool of free memory. The VM allocates memory from this pool. If the Hyper-V host itself requires more memory, it can also be increased in the same way. The dynamic memory usage is different from the memory usage because Hyper-V rejects the guarantee of exceeding the available physical memory in the pool. Ensure that the memory is returned from the VM to the system by balancing the hot addition and hot removal functions from the guest operating system. Let's take a look at the requirements for dynamic memory to evaluate the merits of this method.
First, Hyper-V and the existing Windows virtual machine must have SP1 applied on it. The new versions of Windows 7 and Windows 2008 R2 may have installed the service package.
In addition, Hyper-V can be completed on the basis of each virtual machine. By default, all virtual machines are in the same static memory mode.
: VM Memory Allocation
VM memory allocated to the boot volume is used to start the program. Because the dynamic memory depends on the service and driver of the load on the guest operating system, it must be used only for the memory allocation of the Startup Program () at a time. This is a self-contradictory problem. The OS is not dynamic before it is started, but memory is required to start the OS. Most people suggest that users allocate a large number of internal boot to meet OS startup and applications for their normal operation, leaving dynamic internal processing to deal with "explosive" needs. Microsoft officially said that users only need to allocate enough startup memory to meet OS requirements.
The maximum memory size must be set for the VM, which limits the memory size that the VM can obtain from the pool. The maximum value may be 64 GB.
Finally, you can configure a "memory buffer", which is an additional allocation based on the volume of virtual machines. This buffer is used to offset all excess resources caused by dynamic memory allocation and downward allocation. Therefore, the actual memory allocation is to take on the memory and add this memory buffer.
This buffer is 20% by default. Therefore, if a VM has a quota of 16 GB and uses 4 GB of memory, it is allocated about 820 MB (20% of 4 GB or 4.8 GB in total ). As the memory demand in the Virtual Machine increases, the buffer increases appropriately until the maximum number of configurations is reached. If the Hyper-V host is saturated from the memory perspective, the buffer can be sacrificed, and the host can first serve the memory requirements. Buffer is used as a general cache to improve performance, even if the dynamic memory is not under pressure to complete this work.
Some people will say that this buffer only adds 20% of the memory for dynamic memory execution, while others think this function provides additional management capabilities, so the extra memory is also worth it. Remember, dynamics work only on some supported guest systems. They have some advantages in memory management solutions that are fully controlled by hypervisor because they provide better compatibility for operating systems that are generally running in most enterprise data centers.
If the IT administrator who configures the memory cannot monitor or manage them correctly and all memory management methods are not used, the performance may be reduced. The important thing is to understand the benefits of this model, take the right actions to monitor them, and use dedicated warnings to guide administrators to take steps to avoid problems before they take root.