Understanding vSphere Active Memory

October 5, 2013

News

Understanding vSphere Active Memory

We’ve all seen “Active” memory reported within various vSphere interfaces, but how many us really know what it describes. I think you might be surprised.

Let’s look at its definition to get us started:

Active Memory – ”Amount of memory that is actively used, as estimated by VMkernel based on recently touched memory pages.”

There are some very important details we need to breakdown here. Example: What is it used for? What does estimated mean? How do we define recently?

Background:

VMware virtual memory management was designed from the beginning with several architectural tenants in mind. Two of those being, to leverage a share based allocation and the ability to reclaim idle memory (incidentally a great technical read here). So when memory was in short supply, a share based mechanism could be used to determine how much a virtual machine should get in relation to its peers. To really make intelligent allocation decisions though, an important input into that algorithm would need to be some measure of how much the virtual machine was actually using. Existing proportional share based algorithms were quite static and ratio based. Wanting more, Active memory was born out of the idea that if you could measure what a virtual machine was actually using, that could in turn be input into the share based algorithm making it truly proportional and therefore more realistic. Active memory’s primary purpose is to assist in making memory scheduler allocation decisions.

So now we know why the Active memory counter was created and its purpose. So how does it work?

In order to track active memory, all memory pages that are touched, defined as read from or written to, by the virtual machine would need to be monitored. The cost of monitoring every memory page by the hypervisor and how frequently it was touched wasn’t viable. The overhead generated by that process couldn’t be justified. So instead, a mathematical model was created in which the hypervisor statistically estimates what Active memory is for a virtual machine by use of a random sampling and some very smart math (beyond me – I am in Marketing after all). Due diligence was done at the time this was designed to prove the estimation model did represent real life. So while it is an estimate, we should not be concerned about its accuracy.

Subsequently we’ve now shown that it uses a estimation model to be efficient, but yet maintains its accuracy. Lastly, let’s define recently.

This counter provides you an estimated total of amount of memory that has been touched over the sampling period. This means that depending on where you are looking at this is counter, its sampling period may be different. In vCenter for example, real-time charts show Active memory samples every 20 seconds. This means that it’s showing the estimated amount of memory that is touched by the virtual machine in the last 20 seconds. However in esxtop, the display refresh is every 5 seconds. This means that it’s showing the estimated amount of memory that is touched by the virtual machine in the last 5 seconds.

BUT – Here’s the important part – There is no way to know if the memory pages that were touched in the last number of sampling period are unique or not.

Many people wrongfully assume that since active memory is not really changing, that the virtual machine is only using that amount of memory. This is the assumption that hurts people because they wrongfully assume what it represents and then use it for another purpose for which it wasn’t designed. Remember that its purpose is to assist in allocation in times when memory is scarce – not as a capacity planning counter. Lets solidify this with an example.

Example:

This counter only describes the volume of memory pages that have been touched over the last sampling period. It does not describe if they are the same memory pages or different memory pages between sampling periods.

Sampling Period (vCenter deafult) Active Memory<br /><br /><br /><br /> 1-20 seconds 2GB<br /><br /><br /><br /> 21-40 seconds 2GB<br /><br /><br /><br /> SamplingChart

It would appear here that since every time Active is reported as 2GB, that the virtual machine is only using 2GB of memory. Actually though, it means that the virtual machine has touched between 2GB and 6GB of unique memory pages over 60 seconds. This makes it a great counter to be used in a real-time allocation model, but a very poor counter to be used for capacity planning.

The Takeaway

Active memory can used as a counter to understand how aggressively a virtual machine is touching memory. However, it cannot be used as a “rightsizing” counter on its own. I personally believe the best memory counters are those from the guest operating systems as they truly represent what is allocated and idle. We need to manage memory from the guest perspective. That’s why investments in tools like vCOps and Hyperic are important for both rightsizing and on-going support of troubleshooting activities.

Other Great References:

Understanding Memory Resource Management in VMware vSphere 5.0

http://blogs.vmware.com/vsphere/2013/10/understanding-vsphere-active-memory.html

,

Subscribe

Subscribe to our RSS feed and social profiles to receive updates.

No comments yet.

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

%d bloggers like this: