Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WSFC Resource Metering and Resource Pool

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Resource metering is a new feature of Hyper-V in 2012. strictly speaking, it should be a function of Hyper-V, but why do you say it with WSFC? because Lao Wang found that resource metering and resource pool can be integrated with the cluster, so he specially shared it with you.

Resource metering is the virtualization resource collection technology native to Hyper-V 2012, which is turned off by default. When enabled, it can help us collect the CPU, memory, hard disk and network consumption of each virtual machine.

Typical Application scenarios of Hyper-V Resource Metering

1. Many virtual machines are hosted on the host, and these virtual machines may be used by different departments. Administrators need to ensure that each virtual machine uses the appropriate resources and does not affect other virtual machines. On the one hand, it can be monitored through resource measurement, on the other hand, it can be adjusted through QOS policy restrictions.

two。 Provide data and interface for scheduling of the billing system, which can be Chargeback or Showback, and can realize simple billing management without SCOM and SCSM.

Technical characteristics of Hyper-V Resource Measurement

1. No graphical interface, can be called through powershell or API management

two。 Using a new invocation method is more resource-efficient than the previous way of polling with performance counters

3. Can be used to count individual virtual machines or resource pools

4. Resource metering will follow the virtual machine. No matter which host the virtual machine is migrated to, the metering data is stored in the virtual machine configuration XML file.

5. Support for reset re-metering for virtual machines or resource pools

6. For low performance consumption, there is only some disk and CPU activity when the report is output

7. It is not a virtualization monitoring solution, and only limited parameters are collected for measurement. Monitoring still needs to be used with WMI performance counters and event logs. If you want to perform more in-depth virtualization monitoring, it is recommended to use SCVMM,SCOM.

Hyper-V resources measure the data that can be collected

1. The average CPU utilization is measured in megahertz over a certain period of time.

two。 Average physical memory usage, measured in megabytes.

3. Minimum memory usage (minimum amount of physical memory).

4. Maximum memory usage (maximum amount of physical memory).

5. The maximum disk space capacity allocated to the virtual machine.

6. The total incoming network traffic from the virtual network adapter is measured in megabytes.

7. The total outgoing network traffic of the virtual network adapter is measured in megabytes.

What needs to be paid attention to?

The minimum memory usage only records the data of VM boot status.

Average memory usage records VM boot and VM shutdown data to provide an accurate view of virtual machine memory usage during the billing cycle

CPU usage is measured using converted MHZ instead of%. Microsoft believes that if the percentage is reported, it will be meaningless for virtual machines to move to hosts with different processing capabilities.

The total disk metering value will show the current allocated capacity rather than the current actual use, so for dynamic disks, the maximum allocated disk value will be displayed.

The disk metering total value section will include the snapshot size

Disk metering does not include pass-through disks, DAS disks, ISCSI, virtual fibre Channel disks

Network metering is measured by setting ACL on the virtual machine network adapter. ACL includes direction, IP, action, and action after resource metering is enabled.

Hyper-V Resource Metering comes with Command

Enable / disable resource metering

Get-VMResourceMetering

Disable-VMResourceMetering

Configure VM resources for metering

Set-VMProcessor

Set-VMHardDiskDrive

Set-VMMemory

Set-VMNetworkAdapter

Add-VMNetworkAdapterAcl

Remove-VMNetworkAdapterAcl

Create / delete resource pool

New-VMResourcePool

Set-VMResourcePool

Remove-VMResourcePool

Measure VM and Pool

Measure-VM

Measure-VMResourcePool

Reset-VMResourceMetering

The above gives you a brief introduction to the function of Hyper-V resource measurement to help you review or understand this concept. My good friend Xu Ting wrote a good stand-alone practice blog about Hyper-V resource measurement. Lao Wang will not repeat this aspect. We will mainly practice resource measurement and the integration of resource pools and clusters.

Next, let's take a look at the concept of Hyper-V resource pool, which is not the other resource pool. at present, in Microsoft's enterprise ecosystem, the concept of hyper-v resource pool is mainly used for collection resource measurement, or resource redundancy and load balancing. Resource redundancy and load balancing are mainly reflected in virtual switches.

Root resource pool

By default in hyper-v, all resources belong to a root resource pool, which cannot be seen by the graphical interface. If a resource pool is created separately, the root resource pool will be displayed.

The root resource pool is disabled by default, that is, it does not work

When we enable resource metering for virtual machines, the root resource pool is enabled

The root resource pool is the default collection, in which all host-managed virtual machine resources are included, which are used to summarize and display resource measurement data.

Resource pool

After creating a resource pool, you can display the overall usage of a resource pool through the summary of resource measurement.

User-customized pools will exist as a subset of the root resource pool, but can be configured independently

Provide redundancy and load balancing of the virtual switch resource pool to achieve virtual machine access to the resource pool instead of a single virtual switch. A single virtual switch failure will not affect virtual machine communication.

Virtual switch resource pools can be implemented across hosts, and migration can be performed if different host resource pools have the same name

By default, the virtual machine belongs to the root resource pool. If you need to join the custom resource pool, you need to shut down and join.

Resource pool names of different resource types on the same host can be the same.

For VHD resource pools, you can create VHD resource pools with different paths but the same name on different hosts to enable virtual machines to migrate to automatically update storage paths.

Resource Metering, Resource Pool, Integration with WSFC

After the foundation is laid, it's time to come to our main play. what if these two functions are clustered together?

In fact, Lao Wang believes that if an enterprise deploys multiple virtualized hosts, it will certainly consider deploying highly available clusters to achieve business continuity and prevent stand-alone failures from affecting the above virtual machines. So if we need to measure how to use resources at this time, as it happens, the cluster virtual machine configuration file is stored in a shared area, and the data measured by our virtual machine resources also exist virtual machine configuration files. Therefore, for a clustered virtual machine, we only need to turn on resource metering at the cluster level. No matter which node the virtual machine migrates to, it will not affect the resource metering, and the resource metering level will also rise from the stand-alone to the entire cluster.

Introduction of experimental environment

AD& Beijing ISCSI

Lan:10.0.0.2 255.0.0.0

ISCSI:30.0.0.2 255.0.0.0

12HV01

MGMT: 10.0.0.50 255.0.0.0 DNS 10.0.0.2

ISCSI:30.0.0.50 255.0.0.0

Heart:18.0.0.50 255.0.0.0

12HV02

MGMT: 10.0.0.51 255.0.0.0 DNS 10.0.0.100

ISCSI:30.0.0.51 255.0.0.0

Heart:18.0.0.51 255.0.0.0

At present, the cluster hosts three virtual machines, and the virtual machine is in a shutdown state. This article uses 12R2 cluster as an example, and this function remains unchanged above 16.

Experiment 1. Demonstrate that management resource metering is enabled under the cluster

The cluster itself does not provide the function of resource measurement. Lao Wang has found a way to implement it through Powershell function. The download address is as follows.

ClusterResourcePoolFunctions.PS1

After opening it, you can see the implementation of function in ISE, and only after loading function can you use the ClusterResourcePool command.

# obtain cluster metering status

Get-ClusterResourcePool-Cluster hvcluster

# enable cluster virtual machine resource metering

Here, we can use VMFilter to cooperate with commands to control resource metering. For example, we can name virtual machines according to country, department and use, and enable resource metering only within a named range.

Enable-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT*

# enable the virtual machine

Start-VM-ComputerName 12HV01-Name OGIT-SPDB

# get the measurement status of the cluster resource pool. You can see that the current part is already True, all resources belong to the root storage pool, and the root resource pool is responsible for summarizing the data.

# obtain cluster resource measurement report

Measure-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT*

Here, we can also use the VMFilter command to obtain only the measurement data within a certain logical range of the cluster. We can see that there is only SPDB data here, because other virtual machines have not been powered on once after resource metering is enabled, and data will be generated once other virtual machines are powered on.

If we add the format-list parameter to the command, we can show all the data collected by the resource metering. We can see that because we use function, we will show the data of all nodes in the cluster enabling the resource metering virtual machine.

Experiment 2. Demonstrate the creation of a resource pool under the cluster to match the metered use of resources

# create a cluster resource pool

New-ClusterResourcePool-Cluster hvcluster-ResourcePool OGITPOOL

# obtain the resource pool status to which the virtual machine belongs

Get-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT* | Format-Table

# set the virtual machine resource pool to the newly created cluster resource pool, which needs to be performed when the virtual machine is shut down

Set-ClusterResourcePoolVM-Cluster hvcluster-ResourcePool OGITPOOL-VMFilter OGIT*

# get the resource pool status of the cluster virtual machine again

Get-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT* | Format-Table

# enable virtual machines within the resource pool

Start-VM-ComputerName (Get-ClusterNode-Cluster hvcluster). Name-Name OGIT*

# get the resource metering report of the cluster resource pool. Now we can summarize and display the metering data of virtual machines within a certain range of the cluster through the resource pool. If there are many virtual machines in each node of the cluster, now we can summarize the metering data we need in this way.

Measure-ClusterResourcePool-Cluster hvcluster-poolname-OGITPOOL

Experiment 3. Reset virtual machine, resource pool resource metering data

# shut down the virtual machine within the resource pool. In fact, you can perform a reset operation without shutting down the machine, but the data will increase immediately after the online reset. In order to reinitialize the data, it is recommended to shut down the machine to perform the operation.

Stop-VM-ComputerName (Get-ClusterNode-Cluster hvcluster). Name-Name OGIT*

# get Cluster Resource Pool Metering report

Measure-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT*

# reset the measurement data of a single virtual machine

Reset-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT-SPDB

# reset the metering data of the entire cluster resource pool, and the virtual machine will be re-metered when it is rebooted after the reset.

Reset-ClusterResourcePool-Cluster hvcluster-ResourcePool OGITPOOL

Experiment 4. Turn off cluster virtual machine resource metering, cluster resource pool

# remove the virtual machine from the custom resource pool and return to the root resource pool (to be executed when the virtual machine is shut down)

Set-ClusterResourcePoolVM-Cluster hvcluster-ResourcePool "Primordial"-VMFilter OGIT*

# turn off resource metering for clustered virtual machines

Disable-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT*

# Delete a custom resource pool (you need to ensure that there is no content under the resource pool)

Remove-ClusterResourcePool-Cluster hvcluster-ResourcePool OGITPOOL

# get the status of cluster virtual machine metering enabled

Get-ClusterResourcePool-Cluster hvcluster

# obtain the status of virtual machine resource pool

Get-ClusterResourcePoolVM-Cluster hvcluster-VMFilter OGIT* | Format-Table *-AutoSize

Reference link: http://www.hypervrockstar.com/dd_resource-metering/

At this point, we have completed all the experiments in this chapter. Through Lao Wang's introduction, we believe that everyone will have new thoughts on resource measurement, resource pool, and cooperation with the cluster. Strictly speaking, these are three different functions. But the combination can play a better effect. Resource measurement can be used for standalone, host, cluster, and resource pool virtual machines. Resource pool can summarize and analyze virtual resources to achieve redundancy and load balancing. with the cluster, you can realize the specified range of virtual machines in the resource metering cluster, and summarize the measurement of the specified range of virtual machines in the cluster through the resource pool. I hope this function can be more and more practical in the future, there are more scenarios can be used, hope to see friends can have their own harvest

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report