Querying actual memory use in guest with dynamic memory

I need to programatically determine how much memory a Hyper-V guest with dynamic memory is using, from within the guest running Windows Server 2008 R2, without access to the host.

The total amount the guest thinks it is using is, of course, easy to get.  But most of that is driver locked memory created by the memory balloon, not memory actually in use by the guest.  I have not been able to find a way to query the current size of the memory balloon.

You can see the size of the driver locked memory using Sysinternals RAMMap.exe, but I need a way to get that value in PowerShell.

Any ideas?

January 29th, 2015 8:10pm

Unfortunately querying dynamic memory is simply a moment in time.

And there is no 'balloon' in the Hyper-V world until the host RAM is totally over subscribed.

The way it works is that the VM asks for RAM and Hyper-V determines if there is RAM to give it, and if its maximum has been reached or not.

If there is RAM to give, the % reserve is given to the VM over the request.  The % reserve is to allow a VM to 'burst' RAM faster than DM might be able to respond.

If you enable VM Resource Metering and use Measure-VM you can look at what the pattern is: http://blogs.technet.com/b/virtualization/archive/2012/08/20/how-to-use-resource-metering-with-powershell.aspx

Get-VMMemory just tells you what the setting is.

Free Windows Admin Tool Kit Click here and download it now
January 29th, 2015 10:36pm

Brian,

I am looking to query what the resource use on my server (which is a guest) is at a particular point in time.  I have no access to the virtualization layer.  I need to ask my server what it is using.  It says it is using nearly 6 GB, but it isn't really, because 4 GB of that is "driver locked memory", almost all of which is a dynamic memory balloon.  There has to be a way to query the size of the driver locked memory; after all, Sysinternals RAMMap does so.

So what WMI object or what weird .Net method might let me know what that value is?

Thanks

January 30th, 2015 2:43am

Hi Tim,

I searched but can't find such a WMI to show the memory of "driver blocked" .

Actually, if you want to get the memory usage you can get the real free and zero memory of hyper-v host through running following command:

(Get-WmiObject Win32_PerfFormattedData_PerfOS_Memory -ComputerName localhost).FreeAndZeroPageListBytes

For getting  "driver blocked memory" through WMI/API please try to find the answer within following forum :

https://social.msdn.microsoft.com/Forums/en-US/home?forum=servervirtualization&filter=alltypes&sort=lastpostdesc

Best Regards,

Elton Ji

Free Windows Admin Tool Kit Click here and download it now
January 31st, 2015 11:51pm

Hi Tim,

I would like to check the current sate of this " issue ".

Best Regards,

Elton JI

February 4th, 2015 4:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics