Get started Bring yourself up to speed with our introductory content.

Does VMware have memory sharing capability?

VMware is the standard in virtualization, but does it support memory sharing? Site expert Andrew Kutz has the answer in this expert response.

Does VMware have the ability to memory share? If so, what version? Example: If one VMware virtual machine (VM) needs more memory than allocated, the host would share the memory from another VM. Another example is if VM one has 2GB allocated and is only using 768MB, and VM two has 2GB allocated and needs an additional 512MB, VM two would use the 512mb from VM one until VM one needs it back.

The general answer to your question is yes, VMware products can share memory. The broader answer is that all VMware products have incredibly intelligent and complex memory management capabilities. Because ESX 3 has the widest-range of memory management techniques, we will take a look at that.

When it comes to ESX 3 you will hear a lot of talk about physical page sharing, reservations, limits, and shares.

Physical page sharing can occur when two virtual machines running on the same host server have identical guest operating systems installed. Because all of a virtual machine's memory is mapped by ESX to physical memory, if ESX sees that there is identical memory being used by two virtual machines, ESX can map both virtual machine's memory to the same physical memory. This is a huge simplification of the process that occurs, but the basic idea is covered. Please note that this does not imply a security risk -- as soon as one of the virtual machine's memory becomes dirty, that is it changes, a copy of it is made in physical memory and the physical memory is no longer shared between the two virtual machines (VMs).

A reservation is the amount of a resource, in this case memory, guaranteed to a given virtual machine -- it is the minimum. A limit is the maximum amount of a resource that can be allocated to a given virtual machines -- it is the maximum. Now, just because virtual machine A is guaranteed a reservation of 512 Megabytes (M), if it is only using 300 M, ESX is free to shift the remaining 212 M to other VMs if they request it, but that 212 M will go right back to virtual machine A if it needs it. ESX will not let you power on more VMs than violates the sum total of resources reservations versus the physical amount of that resource. That is, if five VMs all reserve 512 M of memory, and the ESX server only has two Gigabytes (G) of memory (pretending ESX does not use any for itself), you will only be able to power on four virtual machines, because the fifth would violate availability constraints.

You may be thinking, what if I don't reserve any memory for my VMs? Well, you can do that, and in fact a lot of people do just that in development environments where they want to over commit a resource such as memory. That way you could run six VMs on a server with only two G of RAM. At their busiest each VM may use 512 M of RAM (three G of memory), but ESX will let all of them peacefully if their sum total of memory usage does not exceed two G.

You may be wondering how ESX prioritizes who gets first pick at a resource when that resource is in hot demand (I am a little frustrated as I still do not have a Wii!). Well, ESX relies on the administrator to define Resource Shares. These shares prioritize a virtual machine's chances at grabbing available resources. The higher the share, the higher on the list the virtual machine is to get that Wii -- er, memory.

As you can see, VMware has invested a lot of thought into not just memory, but resource management. If I did not answer your question, or you have others, please feel free to email me at akutz at lostcreations dot com. Hope this helps!

Dig Deeper on VMware virtualization