Hyper-V and VMware Dynamic Memory

Hyper-V and VMware Dynamic Memory optimization technique

Virtualization technologies have a different memory optimization technique

Hyper-V is using the guest operating system’s ability to hot add memory to allocate additional memory to the virtual machine to meet demand and ease pressure. This means that the operating system is fully aware of memory amounts. There is no lying. The following figure is quite simplistic but it gives you a comparison to the alternative that is found in other hypervisors.

Dynamic Memory

VMware Virtualization technologies have a memory optimization technique that lies to the guest operating system.

A virtual machine may be configured to have up to 4 GB of RAM. When the guest operating system starts, it will think it has 4 GB of memory. Any applications that run on it or any users that log into it will also see 4 GB of RAM. But in reality, under the hood, the virtual machine will only be assigned whatever memory is required to meet demand for the committed work load, plus maybe an extra buffer amount.

Dynamic Memory  

Hyper-V techniques:

 Advantages:

There is no lying taking place. With this approach

Microsoft approach with Dynamic Memory was to assign only the memory that is required by virtual machines, and to do so without compromising on performance.

Dynamic Memory enabled Hyper-V virtual machine can only use the amount of memory that is physically assigned to it. There is no shared memory paging, and there are no secret caches.

Issues:

What will happen if you give an end user a virtual machine configured to start up with 512 MB and grow to 8 GB; they log in and see 768 MB of RAM?

During SQL Server Installation the setup will query the operating system, and find that t the minimum requirement for 1 GB of RAM doesn’t meet, and that setup won’t be able to continue?

When you configure Dynamic memory you should consider setup programs, such as SQL Server in addition to operating system and system efficiency when you assign start up memory.

VMware techniques:

Advantages:

Where there is some lying taking place. With over commitment approach,

A virtual machine’s guest operating system believes it has maybe 8 GB RAM. It might start up with 512 MB.

Avoid pre requirement problems during installation

Issues:

What happens when there is contention for physical memory on the host?

Paging at the host level must take place. Paging files cannot compare to real RAM.

Paging at the host level is the most inefficient form of paging because the host has no idea what pages should be prioritized, or swapped in/out to improve performance.

 How memory is added and removed from a virtual machine using Hyper-V Dynamic Memory techniques.

I will go through example to explain Hyper-V technique of adding and removing memory to a virtual machine.

Let’s assume that virtual machine has 2 GB of RAM. It has a maximum memory setting of 64 GB.

The guest operating system, applications, and user of the virtual machine can see 2 GB of RAM. No matter what tool or API is used by an application or user, they can only see 2 GB of RAM (the highest amount of memory that the virtual machine has had since it booted up). They will only ever see that high-water mark in those tools within the virtual machine.

Note that a Hyper-V administrator can see the start-up, maximum, and currently assigned memory amounts at the host level using tools such as Performance Monitor or the Hyper-V Manager

Dynamic Memory hot-add balloon

Pressure increases in the virtual machine and Hyper-V responds by adding more memory. Dynamic Memory increases the amount of memory in the virtual machine up to 3 GB. This is the new high water mark for memory and now the guest operating system, applications, and users can see 3 GB of memory in the virtual machine.

Dynamic Memory hot-add balloon

By using a process called ballooning, Hyper-V can return back unused memory from VM to the pool.

When the pressure to memory reduced within the virtual machine, Dynamic Memory cannot shrink VM memory from 3 GB down to 2 GB. Instead, the DMVSC effectively blocks the freed up memory using a balloon.

That means that the guest operating system cannot use the memory until the balloon is shrunk by being re-assigned that memory from the available memory on host.

One the balloon is in place, the DMVSC can work with the parent partition to reassign the physical memory back to the host.

NOTE: you can add a memory to machine but you cannot remove it from machine

The virtual machine in our example now has 2 GB of memory physically assigned to it on the host. However, the guest operating system, applications, and users still see 3 GB of total memory.

They can’t use that additional memory because the DMVSC is blocking it using the balloon.

Note that a virtual machine will never have less than the start-up amount of memory.

Dynamic Memory hot-add balloon

After some time, pressure may increase in the virtual machine. The balloon will shrink as memory is assigned to the virtual machine, making the new memory available to be used by the guest operating system’s processes.

You cannot use tools in a Dynamic Memory enabled virtual machine to determine how much memory it currently has. You can really only tell what the maximum amount of memory was since the virtual machine was started up. This high water mark will reset to the startup memory amount when the guest operating system is restarted or is shut down.

You should use Hyper-V (parent partition) to determine hardware assigned to VM; you cannot determine it from VM.

Microsoft approach with Dynamic Memory was to assign only the memory that is required by virtual machines, and to do so without compromising on performance.

Microsoft accomplished this with the “hot add” approach of assigning additional memory to virtual machines and ballooning process return back unused memory from to virtual machines to the pool.

Dynamic Memory enabled Hyper-V virtual machine can only use the amount of memory that is physically assigned to it. There is no shared memory paging, and there are no secret caches.

If a host has 16 GB RAM then it can only assign up to 16 GB RAM total for both parent partition and the virtual machines.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s