With Windows Server 2008 R2 SP1 we have added a number of new performance counters for dynamic memory. These counters allow you to get some extra insight into what is actually happening with memory on your Hyper-V server. The counters are grouped in two categories. First is “Hyper-V Dynamic Memory VM”:
These counters allow you to access specific information about dynamic memory inside each of the virtual machines on your system. The second category is “Hyper-V Dynamic Memory Balancer”:
These counters allow you to view information about dynamic memory across the entire physical computer.
One thing to note is that unlike the user interface – which uses the concept of “memory availability” (which I discussed yesterday) – the performance counters instead talk about memory pressure. This is measuring the same thing as memory availability (i.e. how much memory does the virtual machine have compared to how much memory does it need) but the math is slightly different. A virtual machine with a pressure of 100 has exactly the amount of memory that it needs (this is equivalent to a memory availability of 0%). If the virtual machine pressure goes over 100 – it now has less memory than it needs (equivalent to a negative memory availability) and if the virtual machine pressure is under 100 then the virtual machine has more memory than it needs.
Virtual machine pressure is simply calculated by taking the amount of memory the virtual machine wants, dividing it by the amount of memory the virtual machine has and then multiplying the result by 100.
My favorite performance counter is the “Average Pressure” counter under the “Hyper-V Dynamic Memory Balancer” category. This gives you a very simple view of the overall memory allocation of your system:
As long as this number is under 100, you know that there is enough memory is your system to service your virtual machines. Ideally this value should be at 80 or lower. The closer this gets to 100, the closer you are to running out of memory. Once this number goes over 100 then you can pretty much guarantee that you have virtual machines that are paging in the guest operating system.