Tuesday, March 10, 2009

VMware Memory Explained




VMware has saved me a boatload of both time and money. When trying to figure out the memory utilization on the ESX host I have the other day, both my buddy and I wanted to pull our hair out because none of the numbers seemed to add up. We had the Microsoft Server 2oo3 Task Manager up and we were trying to compare the numbers to what was in the WMware Inftastructure Client and nothing seemed to match up exactly. What was found online, was found in bits and pieces and everything finally made sense, hours later. The result of all of the google searches, reading and head scratching is the image above and the information below. I hope it saves you time and your hair!

Memory Consumed =

Memory Granted – Memory Shared

Host memory usage – Memory Overhead


Memory usage % =

Memory Active / Memory Granted

Guest Memory Usage / Memory Granted


Windows Server Physical Memory (K) Total = Memory Granted to ESX VM

Windows Server Physical Memory (K) Available = Memory Shared


The difference of the two numbers above is equal to the Memory Consumed.


ESX Performance Graphs:

Memory Consumed (total amount used by guest; see Windows Task Mgr)

Memory Active (amount currently being used by guest)

Memory Usage (% of active memory relative to amount granted to guest)

Memory Shared (amount not currently used & available to share with others)


ESX VM Summary General:

Memory: amount configured (granted) for the VM

Memory Overhead: amount required by ESX for housekeeping the VM


ESX VM Summary Resources:

Host memory usage: amount the VM is using from the host

Guest memory usage: amount actively being used by the VM

6 comments:

Juan said...

Great tip. Thanks for finally rounding up all this info. Did you stumble on any good docs that provide good general practices for allocating physical memory on your server to all the virtual machines? Something formulaic?

Hans said...

Juan,

Each environment and VM is different, so something that works for me may not necessarily work or be best for your environment. I monitor the memory resource usage while my VM's are under a typical load and keep the utilization under 80%. This allows me to over subscribe memory on the resource but allows for spikes in memory usage when needed. If the utilization gets too close for my comfort, all I need to do is VMotion hosts to other resources.

Matt Ray said...

Hi Hans,

I understood that memory shared is blocks of memory which are identical between guest VMs on a host, and are 'de-duplicated'.

For example, if you have multiple Server 2003 VMs running on a host, chances are a small portion of their memory will be identical as they are running the same OS. The ESX host thus stores only one instance of the memory block rather than multiple copies of the same memory block, and the guest VMs have pointers to the 'shared' memory. This saves physical memory on the host as it 'de-duplicates' memory.

The Available Physical Memory you see on the task manager view is just memory which is not being actively used by the guest and is not related to Memory shared.

This paper explains it well: http://communities.vmware.com/servlet/JiveServlet/download/2380-17273/VI+3.5+Memory+Statistic+Definitions.pdf

Matt

Relicary said...

Great post! It's most useful. Thank you very much

Anonymous said...

Thanks ....

Anonymous said...

The explaination is incorrect. You should read the whitepaper provided by VMware to understand Shared memory. It is the memory shared with 2 or more VMs instead of 'memory not in use and can be shared'