Measuring disk performance on HyperV VMs

(First of all, sorry for bad formatting..)

Keeping track of how much capacity a virtual disk is taking up is very important for several reasons:

You don’t want to overcommit your CSVs with growing thin provisioning vhdx’s

You don’t want “rogue VMs” to run lose and eat up IOPS from other VMs

 

Monitoring diskperformance, IOPS, bytes read and written, etc. can be monitored using PowerShell.

 

You start with enabling monitoring on your VM of choice:

Get-VM -VMName Server01 -ComputerName S2DHost01 | Enable-VMResourceMetering

Now you can get Properties of the VM by using the Measure-VM cmdlet:
Get-VM -VMName Server01 -ComputerName S2DHost01 | Measure-VM | fl
VMId : xxxxxxxxxxxxx
VMName : Server01
CimSession : CimSession: S2DHost01.local
ComputerName : S2DHost01
MeteringDuration :
AverageProcessorUsage : 80
AverageMemoryUsage : 8192
MaximumMemoryUsage : 8192
MinimumMemoryUsage : 8192
TotalDiskAllocation : 131072
AggregatedAverageNormalizedIOPS : 0
AggregatedAverageLatency : 0
AggregatedDiskDataRead : 1
AggregatedDiskDataWritten : 16
AggregatedNormalizedIOCount : 2321
NetworkMeteredTrafficReport : {Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport, Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport, Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport,
Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport}
HardDiskMetrics : {Microsoft.HyperV.PowerShell.VHDMetrics}
AvgCPU : 80
AvgRAM : 8192
MinRAM : 8192
MaxRAM : 8192
TotalDisk : 131072

Picking just the Properties you are interested in can be done like this:
Get-VM -VMName $vmName -ComputerName $node.name -ErrorAction Stop | Measure-VM | fl vmname, computername, AggregatedAverageNormalizedIOPS, AggregatedAverageLatency, AggregatedDiskDataRead, AggregatedDiskDataWritten, AggregatedNormalizedIOCount

Server01 @ S2DCluster
VMName : Server01
ComputerName : S2DHost01
AggregatedAverageNormalizedIOPS : 0
AggregatedAverageLatency : 0
AggregatedDiskDataRead : 1
AggregatedDiskDataWritten : 16
AggregatedNormalizedIOCount : 2321

If you are balancing load on your VM hosts and you don’t always have complete track on on which host your favourite VM is located, you can use the script here to apply metering and measure the VM regardless of where it is:
#Enable-VMResourceMetering
$clustername = 'S2DCluster'
$vmName = 'Server01'
$cluster = get-cluster $clustername
$nodes = Get-ClusterNode -Cluster $cluster
foreach($node in $nodes) {
try {
Get-VM -VMName $vmName -ComputerName $node.name -ErrorAction Stop | Enable-VMResourceMetering
}
Catch {}
}

#Measure-VM

$clustername = ‘S2DCluster’
$vmName = ‘Server01’
$cluster = get-cluster $clustername
$nodes = Get-ClusterNode -Cluster $cluster
foreach($node in $nodes) {
try {
$vm = Get-VM -VMName $vmName -ComputerName $node.name -ErrorAction Stop
$vm | Measure-VM
}
Catch {}
}

 

Advertisements
Posted in hyperv, virtualization, performance, monitoring

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: