Hyper-V Server memory Technology (1)

Source: Internet
Author: User

After the memory is allocated to the virtual machine, the Hyper-V host allocates the system's available memory resources to the virtual machine after it is created, and the default memory we call static memory, that is, how much g memory you give to the virtual machine when you create the VM, and the Windows Server 2012/R2 Hyper-V provides dynamic memory capabilities that enable administrators to readjust resources so that limited memory resources can be leveraged to achieve better memory consolidation and higher management efficiencies.

One: Static memory: That is, the memory allocated to the virtual machine. When the virtual machine does not start, it does not consume the physical computer memory, and when the virtual machine starts, it divides the memory from the physical computer into the virtual machine, and the physical computer reduces the same size of memory.

650) this.width=650; "height=" 523 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/7D/ Wkiom1ser23h0qfiaakdceysc4g376.jpg "border=" 0 "/>

Two: Dynamic memory:

(i) Technical Overview: "Dynamic Memory" introduced in Windows Server R2 Service Pack 1 (SP1), which defines the minimum amount of memory that the startup memory is defined as the virtual machine. However, Windows requires more memory during startup than in a steady state. As a result, administrators sometimes allocate additional memory to virtual machines because Hyper-V cannot reclaim memory from these virtual machines after startup. In Windows Server 2012/r2, dynamic memory introduces a minimum memory setting that allows hyper-V to reclaim unused memory from the virtual machine. This is reflected in the increased number of virtual machine merges, especially in Virtual Desktop infrastructure (VDI) environments. Windows Server 2012/R2 also introduces smart paging technology for reliable virtual machine restart operations. Although the minimum memory can increase the number of virtual machine merges, it also poses a challenge. If a virtual machine has a smaller amount of memory than its startup memory, if it restarts, Hyper-V requires additional memory to restart the virtual machine. Because of host memory pressure or virtual machine state, Hyper-V may not always have additional memory available. This may occasionally cause a virtual machine restart to fail. Smart paging is used to compensate for the gap between the lowest memory and boot memory, allowing virtual functions to restart reliably.

(ii) Terminology:

A. Memory Overload:

1. What is memory Overload: Excessive memory use allows the virtual machine to use more memory than is available to the physical host, such as the host has 2G of memory and can run 4 virtual machines with 1G of memory on it. Excessive memory usage because there is more virtual memory than the host, the enterprise administrator can maximize the number of virtual machines in the physical host without taking care of the total physical memory limit. Without this technology, the virtual machine memory size can only be the same as the virtual host memory usage. In an enterprise real-world production environment, virtual machines typically consume less memory than required, which is detrimental to the full use of hardware resources and limits the number of virtual machines that can run on the current server.

2. Hyper-V does not support excessive memory use: Hyper-V does not allow excessive memory usage, for example, if you allocate 4GB of memory to a virtual machine for Hyper-V, you actually use only 2GB of memory when starting this virtual machine, but Hyper-V checks to see if there is 4GB of physical memory available. If so, the 4GB memory allocated to this virtual machine will be locked and used only for this virtual machine, and if 4GB is not available, the virtual machine cannot be started, even if only 2GB of memory is required.

3. Hyper-V Memory usage mechanism: Hyper-V allows the use of unitary Chinese virtual machine memory based on memory utilization by providing "memory buffers", "Memory weights", and "memory priority". When contention memory occurs, a virtual machine configured with a high priority first obtains internal memory resources. Hyper-V Manager shows that the memory usage of the less virtual machine helps administrators better manage memory allocations.

B. Memory buffers:

1. What's the memory buffer: the basic settings for Hyper-V virtual memory, reserving additional space for each virtual machine. Memory buffers provide more memory space for virtual machines than is actually required. The virtual machine memory buffers are calculated using a percentage, which defaults to 20%, and the Microsoft buffer Percentage range is 5% to 95%.

2, Memory buffer operation mechanism:

(1) the reserved area can be used when the memory requirement is suddenly increased at a time interval of grinding. In the absence of a cache, the sudden increase in memory requirements during this time interval forces the virtual machine into a memory overflow state, in which case the memory paging file is automatically written to disk and the data is transferred from the high-speed memory space to the relatively slow disk, resulting in a noticeable decrease in computational performance.

(2) When the memory requirement changes, the additional reserved space can reduce the probability that the memory data of the virtual machine is written to disk. At the same time, the larger cache space also brings waste. The reserved memory area is always available, so it is idle until the virtual machine is used by it. The user is set to a wide range, and the Microsoft buffer Percentage range is 5% to 95%, and the administrator can set any number. It is generally recommended that you start with a lower setting and adjust this percentage when you find that the virtual machine is always written to disk.

C. Memory Weights:

1. What is memory Weight: Hyper-V dynamic memory technology always balances memory usage, but sometimes memory resources do not meet the needs of all virtual machines. If you enable too many virtual machines, or when a virtual machine is running an application that suddenly requires a large amount of memory resources, the memory weight setting can set priority classification on the virtual machine when this happens. A low-priority virtual machine cannot obtain memory resources until the high-priority virtual machine memory allocation is complete.

2, the role of memory weight:

(1) High-priority virtual machines get more memory;

(2) Low-priority virtual opportunities are preferentially "snatched" memory;

(3) When starting a "new" virtual machine, the memory given to him from the running virtual machines occupy the memory, the specific allocation of how much, depends on the memory weight of the boot virtual machine.

3, Memory calculation:

(1) Calculation formula: Virtual machine available memory = Boot memory + boot memory * (buffer percentage/(1-buffer percentage));

(2) Example: The administrator creates a new virtual machine, allocates a memory size of 1200MB, the buffer percentage is 20%, then Hyper-V attaches an additional 20%/(1-20%) =300MB, which is a total of 1500MB of memory to the virtual machine. If the administrator sets a buffer percentage of 80%, an additional 80%/(1-80%) *1200MB=4800MB, which is a total of 6000MB of memory, is appended to the virtual machine.

650) this.width=650; "height=" 619 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/7D/ Wkiom1ser26wvn1maajo9vmo8aw390.jpg "border=" 0 "/>

D. Smart paging:

Windows Server 2012/R2 also introduces smart paging technology for reliable virtual machine restart operations. Although the minimum memory can increase the number of virtual machine merges, it also poses a challenge. If a virtual machine has a smaller amount of memory than its startup memory, if it restarts, Hyper-V requires additional memory to restart the virtual machine. Because of host memory pressure or virtual machine state, Hyper-V may not always have additional memory available. This may occasionally cause a virtual machine restart to fail. Smart paging is used to compensate for the gap between the lowest memory and boot memory, allowing virtual functions to restart reliably. If the virtual machine is configured with less memory than the boot memory, Hyper-V uses smart paging in Windows Server 2012/R2 in order to provide a reliable restart operation. This memory management method uses disk resources as additional temporary memory when restarting a virtual machine requires more memory. This method has both advantages and disadvantages. It provides a reliable way to ensure that the virtual machine is functioning correctly when no physical memory is available. However, it also reduces the performance of the virtual machine because disk access is much slower than memory access.

1. To minimize the impact of "smart paging" on performance, Hyper-V uses it only in the following cases:

(1) The virtual machine is being restarted;

(2) When no physical memory is available;

(3) When there is no recoverable memory in other virtual machines running on the host;

2. "Smart paging" cannot be used in the following situations:

(1) The virtual machine is starting from "off state" (instead of restarting);

(2) Require oversubscribed memory for running virtual machines;

(3) When a virtual machine is performing a failover in a Hyper-V cluster

When host memory is oversubscribed, Hyper-V continues to rely on paging operations in the guest operating system because it is more efficient than "smart paging". In the guest operating system, paging operations are performed by the Windows memory manager. The Windows Memory Manager has more information about memory usage within a virtual machine than a Hyper-V host, which means that the Windows Memory Manager can provide better information than Hyper-V when choosing memory for paging. Because of this, it can lead to less overhead than "smart paging". To further reduce the impact of smart paging, hyper-V removes memory from the virtual machine after the startup is complete. To achieve this, it coordinates with the dynamic memory component in the guest operating system (sometimes referred to as a "balloon" (ballooning)), which causes the virtual machine to stop using "smart paging." Using this technique, the use of "smart paging" is only temporary and is not expected to exceed 10 minutes. Need to note:

(1) The "Smart paging" file is created only when the virtual machine is needed;

(2) After removing the additional amount of memory, the system will also delete the "smart paging" file;

(3) until the next time a virtual machine needs to be restarted without enough physical memory, it cannot use smart paging again.

Shows the memory mapping of virtual machines that are restarted using Hyper-V smart paging.

650) this.width=650; "height=" 262 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/7D/ Wkiom1ser27hhcfcaacegekdklu102.jpg "border=" 0 "/>

To further reduce the impact of Hyper-V smart paging, after the virtual machine starts, Hyper-V removes memory from the virtual machine and coordinates with the dynamic memory components within the client (this process is sometimes referred to as "bloat"), so the virtual machine stops using Hyper-V smart paging. In this technology, the use of Hyper-V smart paging is temporary and should not exceed 10 minutes. Shows that hyper-V removes memory from the virtual machine after the virtual machine finishes booting.

650) this.width=650; "height=" 238 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/7D/ Wkiom1ser27sj5ekaacecqwdy38688.jpg "border=" 0 "/>

Windows Server 2012/R2 begins the enhancement of Hyper-V dynamic memory, helping to achieve a higher number of merges while enhancing the reliability of Hyper-V operations. You can modify the memory configuration of a virtual machine without shutting down the virtual machine. If you have an idle virtual machine or a low-load virtual machine, such as in a pooled VDI environment, Hyper-V adds dynamic memory that can be used to increase the amount of consolidation and improve the reliability of the restart operation. This can reduce the cost of the customer, especially in a pooled environment with many idle or low-load virtual machines. With runtime configuration modifications to dynamic memory, you can reduce downtime and increase agility to respond to changes in demand, resulting in overall IT productivity gains. These new features also enable agility to respond to changes in demand.

This article is from the "Xu Ting blog" blog, make sure to keep this source http://ericxuting.blog.51cto.com/8995534/1587335

Hyper-V Server memory Technology (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.