Share This:

In reporting memory usage for VMWare VMs, a perennial question we get is: should we be looking at "active" memory, or "consumed" memory for a VM?

 

And the answer, as it so often is, is "it depends"--- it depends on what exactly you are trying to measure.

 

If you want to measure how efficiently you are using your VMWare environment's memory resources to run workloads, then you want to compare the total memory that your workloads have been given (given), against the total available memory resources on your hosts (avail).  If you are just starting to virtualize your workloads, you would expect this efficiency number given/avail to be much less than 1.  As you pack more and more workloads, you would expect it to rise close to 1.  And as you become an expert at managing your environment and leveraging the capabilities of VMWare ESX, it could exceed 1.  (I will explain how it could exceed 1 later).

 

In the above calculations, for the quantity given, i.e., the amount of memory given to the workloads, VMWare publishes two counters through its API that can be used:

  • memory granted per VM
  • memory consumed per VM

 

Either of these could be summed over all the VMs to compute given; the only difference is that the "consumed" counter subtracts some kinds of memory savings achieved by ESX, so if you use "consumed" instead of "granted", you get a somewhat lower efficiency number. Just pick one of these counters and use it consistently.  For the quantity avail, we can use the total host memory sizes of all the hosts.

 

You can compute this efficiency measure on a per host basis, too, using the same counters.

 

On the other hand, if you want to measure whether a workload is actually using the memory it has been given, then you want to compare the memory the VM is actively using (the "active" memory counter reported by VMWare) to the guest memory size or to memory granted.  This is a much narrower question about a single VM's behavior during a short period of time.

 

So, to summarize:

 

  • For measuring over-all efficiency, look at memory consumed (or granted).
  • For analyzing memory usage of individual VMs during a short period, look at memory active.

 

As for how efficiency can exceed 1: VMWare ESX includes several memory management features that optimize the use of the host's memory resources to get higher VM densities. Three of these features (transparent page sharing, ballooning, and swapping) are explained in detail in the VMWare paper Understanding Memory Resource Management in VMWare ESX Server.(PDF). These features make it possible to run VMs on less real memory than they have been granted in total, making the efficiency measure greater than 1.