none
Hyper-V Resource Pools for Memory and CPU

    Question

  • Hi all,

    I'm trying to understand the concepts and details of resource pools in Hyper-V in Windows Server 2012. It seems as if there is almost no documentation on all that. Perhaps somebody can support me here, maybe I've not seen some docs yet.

    So far, I learned that resource pools in their current implementation serve mainly for metering purposes. You can create pools per tenant and then group VM resources into those pools to facilitate resource metering per tenant. That is, you enable metering once per pool and get all the data necessary to bill that one customer for all their resources (without metering individual VMs). Is that correct?

    Furthermore, it seems to me that an ethernet pool goes one step further by providing an abstraction level for virtual switches. As far as I've understood you can add multiple vSwitches to a pool and then connect a VM to the pool. Hyper-V then decides which actual switch to use. This may be handy in a multi-host environment if vSwitches on different hosts use different names although they connect to the same network. Is that correct?

    So - talking about actually managing that stuff I've learned how to create a pool and how to add VHD locations and virtual switches to a pool. Enabling resource metering for a pool then collects usage data from all the resources inside that pool.

    But now: I can create a pool for memory and a pool for CPU. But I cannot add resources to those. Neither can I add a complete VM to a pool. Now I'm launching a VM that belongs to a customer whose resources I'm metering. How will Hyper-V know that it's supposed to collect data on CPU and memory usage for that VM?

    Am I missing something here? Or is pool-based metering only good for ethernet and VHD resources, and CPU and memory still need to be metered per VM?

    Thanks for clarification,

    Nils


    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

    Sunday, January 6, 2013 6:58 PM

Answers

  • Thank you for the links. I already knew those, and unfortunately they are not matching my question. Two of them are about Windows Server 2008/R2, and one only lists a WMI interface. What I'm after is a new feature in Windows Server 2012, and I need conceptional information.

    Thanks for the research anyway. I appreciate that a lot!

    In the meantime I've gotten quite far in my own research. See my entry above of January 7th. Some additions:

    • In Windows Server 2012, Hyper-V resource pools are mainly for metering purposes. You cannot compare them to resource pools in VMware.
    • A resource pool in Hyper-V (2012) facilitates resource metering and billing for VM usage especially in hosting scenarios. You can either measure resource usage for single VMs, or you can group existing resources (such as CPU power, RAM, virtual hard disk storage, Ethernet traffic) into pools. Those pools will mostly be assigned to one customer each. That way you can bill the customer for their resource usage in a given time period by just querying the customer's pool.
    • Metering only collects aggregated data with one value per resource (i.e. overall CPU usage, maximum VHD storage, summed Ethernet traffic and so on). You can control the time period by explicitly resetting the counter at any given time (a day, a week, a month or what you like).
    • There is no detailed data. The aggregate values serve as a basis for billing, not as monitoring data. If you need detailed monitoring data use Performance Monitor.
    • There is currently only one type of resource pool that adds an abstraction layer to a virtualization farm, and that is the Ethernet type. You can use that type for metering, but you can also use it to group a number of virtual switches (that connect to the same network segment) and then a VM connected to that pool will automatically use an appropriate virtual switch from the pool. You need no longer worry about virtual switch names across multiple hosts as long as all equivalent virtual switches are added to the pool.
    • While you can manage two types of pool resources in the GUI (VHD pools and Ethernet pools) you should only manage resource pools via PowerShell. Only there will you be able to control what happens. And only PowerShell provides a means to start, stop, and reset metering and query metering data.
    • The process to use resource pools in Hyper-V (2012) in short:
    • First create a new pool via PowerShell (New-VMResourcePool). (In case of a VHD pool you must specify the VHD storage paths to add to the pool in the moment you create the pool.)
    • In case of an Ethernet pool add existing virtual switches to the pool (Add-VMSwitch).
    • Reconfigure existing VMs that you want to measure so that they use resources from the pool. The PowerShell Set-VM* commands accept a parameter -ResourcePoolName to do that. Example: Set-VMMemory -VMName APP-02 -ResourcePoolName MyPool1
    • Start measuring with Enable-VMResourceMetering.
    • Query collected data as often as you need with Measure-VMResourcePool. Note that you should specify the pool resource type in the command to get reliable data (see my post above, Jan 7th).
    • When a metering period (such as a week or a month) has passed, reset the counter to zero with Reset-VMResourceMetering.

    Hope that helps. I consider this the answer to my own question. ;)

    Here's some links I collected:

    http://itproctology.blogspot.ca/2012/12/hyper-v-resource-pool-introduction.html

    http://www.ms4u.info/2012/12/configure-ethernet-resource-pool-in.html

    http://blogs.technet.com/b/virtualization/archive/2012/08/16/introduction-to-resource-metering.aspx

    http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/1ce4e2b2-8fdd-4f16-8ab6-e1e1da6d07e3

    Best wishes, Nils


    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

    Thursday, January 10, 2013 9:08 AM

All replies

  • you confused :)

    me too.. but i ended up with this, you can create them just for metering and not like storage and network.

    Regards


    ------------------------------------------------------- I understand a little computers.

    Monday, January 7, 2013 3:20 AM
  • Hi,

    > That is, you enable metering once per pool and get all the data necessary to bill that one customer
    > for all their resources (without metering individual VMs). Is that correct?

    Yes. Resource Pool in Windows Server 2012 Hyper-V is mainly used for resource metering. Resource pools are logical containers that collect resources of virtual machines belonging to one client, permitting single-point querying of the client’s overall resource use.

    > As far as I've understood you can add multiple vSwitches to a pool and then connect a VM to the pool.

    I think there is some confusion with the resource pool in Windows Server 2012. Generally, we know a “resource pool” definition in SCVMM or VDI, that is a pool of resources which can be used by any VMs in the pool. However “resource pool” in Windows Server 2012 only means a logical container, just a name, you can consider it as a VM attribute. When you enable Resource Metering for a VM you can define the “ResourcePoolName” attribute, then you can collect data for VMs which has the same attribute. The logical VM group, that’s the definition of resource pool at here.

    Refer to following articles, these articles will help you to understand it:

    Enable-VMResourceMetering
    http://technet.microsoft.com/en-us/library/hh848481.aspx
    Introduction to Resource Metering
    http://blogs.technet.com/b/virtualization/archive/2012/08/16/introduction-to-resource-metering.aspx
    How to Use Resource Metering With PowerShell
    http://blogs.technet.com/b/virtualization/archive/2012/08/20/how-to-use-resource-metering-with-powershell.aspx
    Hyper-V Resource Metering Overview
    http://technet.microsoft.com/en-us/library/hh831661.aspx

    Hope this helps!

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.

     


    Lawrence

    TechNet Community Support

    Monday, January 7, 2013 6:43 AM
    Moderator
  • Thank you, Lawrence,

    this helps a lot! Nevertheless, some questions remain.

    There are some rare desciptions on the web that describe the Ethernet pools the way I wrote above: Those are not just logical names for resource metering but they provide a means to automatically connect a VM to "just one item" inside the pool. The sources say further that this helps in Live Migration scenarios where vSwitches in a pool do not have to have the same names any longer. Is that assumption correct? (I would test it but it would take quite large an effort, so if anybody could tell me ...)

    The second item is the practical management of pools, especially CPU and memory, as I stated above. I can create pools for those but how will I assign actual CPU or memory there? When I have enabled metering for a CPU or memory pool, Get-VMResourcePool still tells me that it is disabled ... and I get no data. Does CPU and memory metering even work at the pool level right now?

    Thanks, Nils


    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

    Monday, January 7, 2013 7:56 AM
  • Okay,

    seems I've gotten one step further. Maybe it's that one important step ...

    I found out that VM memory and VM CPU must indeed be added explicitly to the respective Resource Pools before you can enable the pools for measuring. But, in contrast to the task sequences for VHD and Ethernet pools, you can only add Memory and CPU resources via PowerShell. Those pools will then not even be displayed in the GUI (that as well is in contrast to VHD and Ethernet pools that do display in the GUI at the VM Settings dialog).

    Both the Set-VMMemory and the Set-VMProcessor cmdlets have a parameter -ResourcePoolName where you can specify an existing Resource Pool. Once this is done (and the VM has been restarted, I guess) you can finally enable metering for the CPU or Memory pool. And after that you can do Measure-VMResourcePool and get values for Memory or CPU.

    One more weirdness I came across: Contrary to the TechNet documentation, Measure-VMResourcePool will not return correct values when you query more than one ResourcePoolType at once. I had to query each type separately to get correct values.

    Example 1: This does not display correct values for the Ethernet pool.

    PS C:\Users\Administrator> Measure-VMResourcePool ResPl-Verwaltung -ResourcePoolType @("Ethernet","VHD")

    Name             ResourcePoolType AvgCPU(MHz) AvgRAM(M) TotalDisk(M) NetworkInbound(M) NetworkOutbound(M)
    ----             ---------------- ----------- --------- ------------ ----------------- ------------------
    ResPl-Verwaltung {Ethernet, VHD}                        130048       0                 0                

    Example 2: This does display the correct values - note the -ResourcePoolType parameter I added.

    PS C:\Users\Administrator> Measure-VMResourcePool ResPl-Verwaltung -ResourcePoolType Ethernet

    Name             ResourcePoolType AvgCPU(MHz) AvgRAM(M) TotalDisk(M) NetworkInbound(M) NetworkOutbound(M)
    ----             ---------------- ----------- --------- ------------ ----------------- ------------------
    ResPl-Verwaltung {Ethernet}                                          2                 2                

    And here's what I did to enable the Memory metering:

    PS C:\Users\Administrator> New-VMResourcePool ResPl-Verwaltung -ResourcePoolType Memory

    Name             ResourcePoolType ParentName   ResourceMeteringEnabled
    ----             ---------------- ----------   -----------------------
    ResPl-Verwaltung Memory           {Primordial} False                 

    [...]

    PS C:\Users\Administrator> Stop-VM v-app-01

    PS C:\Users\Administrator> Set-VMMemory -VMName v-app-01 -DynamicMemoryEnabled $True -MinimumBytes 384000000 -ResourcePoolName ResPl-Verwaltung -StartupBytes 550000000

    PS C:\Users\Administrator> Enable-VMResourceMetering -ResourcePoolName ResPl-Verwaltung -ResourcePoolType Memory

    PS C:\Users\Administrator> Start-VM v-app-01

    PS C:\Users\Administrator> Measure-VMResourcePool ResPl-Verwaltung -ResourcePoolType Memory | fl

    ComputerName                : HYP-01
    ResourcePoolType            : {Memory}
    ResourcePoolName            : ResPl-Verwaltung
    MeteringDuration            : 02:55:35.3230000
    AverageProcessorUsage       :
    AverageMemoryUsage          : 36
    MaximumMemoryUsage          : 524
    MinimumMemoryUsage          : 512
    TotalDiskAllocation         :
    NetworkMeteredTrafficReport : {}
    AvgCPU                      :
    AvgRAM                      : 36
    MinRAM                      : 512
    MaxRAM                      : 524
    TotalDisk                   :

     

    The curtain is slowly rising. However, this lack of documentation is a shame.

    Thanks, Nils

     


    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany


    Monday, January 7, 2013 12:32 PM
  • well yes

    as told you, you have to create the pool, and then enable metering on it. nothing more.

    Regards


    ------------------------------------------------------- I understand a little computers.

    Monday, January 7, 2013 4:33 PM
  • Thank you for the links. I already knew those, and unfortunately they are not matching my question. Two of them are about Windows Server 2008/R2, and one only lists a WMI interface. What I'm after is a new feature in Windows Server 2012, and I need conceptional information.

    Thanks for the research anyway. I appreciate that a lot!

    In the meantime I've gotten quite far in my own research. See my entry above of January 7th. Some additions:

    • In Windows Server 2012, Hyper-V resource pools are mainly for metering purposes. You cannot compare them to resource pools in VMware.
    • A resource pool in Hyper-V (2012) facilitates resource metering and billing for VM usage especially in hosting scenarios. You can either measure resource usage for single VMs, or you can group existing resources (such as CPU power, RAM, virtual hard disk storage, Ethernet traffic) into pools. Those pools will mostly be assigned to one customer each. That way you can bill the customer for their resource usage in a given time period by just querying the customer's pool.
    • Metering only collects aggregated data with one value per resource (i.e. overall CPU usage, maximum VHD storage, summed Ethernet traffic and so on). You can control the time period by explicitly resetting the counter at any given time (a day, a week, a month or what you like).
    • There is no detailed data. The aggregate values serve as a basis for billing, not as monitoring data. If you need detailed monitoring data use Performance Monitor.
    • There is currently only one type of resource pool that adds an abstraction layer to a virtualization farm, and that is the Ethernet type. You can use that type for metering, but you can also use it to group a number of virtual switches (that connect to the same network segment) and then a VM connected to that pool will automatically use an appropriate virtual switch from the pool. You need no longer worry about virtual switch names across multiple hosts as long as all equivalent virtual switches are added to the pool.
    • While you can manage two types of pool resources in the GUI (VHD pools and Ethernet pools) you should only manage resource pools via PowerShell. Only there will you be able to control what happens. And only PowerShell provides a means to start, stop, and reset metering and query metering data.
    • The process to use resource pools in Hyper-V (2012) in short:
    • First create a new pool via PowerShell (New-VMResourcePool). (In case of a VHD pool you must specify the VHD storage paths to add to the pool in the moment you create the pool.)
    • In case of an Ethernet pool add existing virtual switches to the pool (Add-VMSwitch).
    • Reconfigure existing VMs that you want to measure so that they use resources from the pool. The PowerShell Set-VM* commands accept a parameter -ResourcePoolName to do that. Example: Set-VMMemory -VMName APP-02 -ResourcePoolName MyPool1
    • Start measuring with Enable-VMResourceMetering.
    • Query collected data as often as you need with Measure-VMResourcePool. Note that you should specify the pool resource type in the command to get reliable data (see my post above, Jan 7th).
    • When a metering period (such as a week or a month) has passed, reset the counter to zero with Reset-VMResourceMetering.

    Hope that helps. I consider this the answer to my own question. ;)

    Here's some links I collected:

    http://itproctology.blogspot.ca/2012/12/hyper-v-resource-pool-introduction.html

    http://www.ms4u.info/2012/12/configure-ethernet-resource-pool-in.html

    http://blogs.technet.com/b/virtualization/archive/2012/08/16/introduction-to-resource-metering.aspx

    http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/1ce4e2b2-8fdd-4f16-8ab6-e1e1da6d07e3

    Best wishes, Nils


    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

    Thursday, January 10, 2013 9:08 AM
  • Hi Nils,

    First of all, thanks for sharing.  This information has greatly helped my studies.  I went through a little 'pain' when also configuring VM Resource Pools for virtual machine disks, so I though I would add to your post here if you don't mind.  Please note that in my example, my server names are 'MEM01' and 'MEM02':

    #Disk VM Resource Pool example.  Note only aggregated figures are presented

    Stop-VM -name mem01,mem02 -Force

    #Create new VM Resource Pool

    New-VMResourcePool -name "DDrivePool" -ResourcePoolType VHD -Paths "D:\Virtual Hard Disks"

    # VMs must be turned off to modify Hyper-V settings.  Note although the -Controller* parameters are not strictly required, I found that I had to provide these in order for the command to work!

    Set-VMHardDiskDrive -ControllerLocation 1 -ControllerNumber 0 -ControllerType IDE -VMName mem01 -ResourcePoolName "DDrivePool"

    Set-VMHardDiskDrive -ControllerLocation 1 -ControllerNumber 0 -ControllerType IDE -VMName mem02 -ResourcePoolName "DDrivePool"

    Start-VM -name mem01,mem02

    Measure-VMResourcePool 'DDrivePool'

    Example Output:

    Name       ResourcePoolType AvgCPU(MHz) AvgRAM(M) TotalDisk(M) NetworkInbound(M) NetworkOutbound(M)

    ----       ---------------- ----------- --------- ------------ ----------------- ------------------

    DDrivePool {VHD}                                  103842       0                 0

    Hope this helps someone.

    Rafael

    Wednesday, August 20, 2014 7:44 AM