MAX IOPS within the last 5 minutes

 

Why are IOPS important? It is a benchmark for how many read and write commands can be executed in a second. This can have an impact on throughput, latency and the rotational speed of the disks your VM’s sit on. IOPS should be used to design your storage strategy accordingly. What is the calculations for IOPS? It’s 1 / (rotational latency + average read / write seek time).

 

I ran across another good PowerCLI script from LucD that I wanted to share. This shows the last 5 minutes worth of IOP traffic for your VM’s.

 

_____________________________________________________________

 

$metrics = “disk.numberwrite.summation”,”disk.numberread.summation”  $start = (Get-Date).AddMinutes(-5)  $report = @()

 

$vms = Get-VM | where {$_.PowerState -eq “PoweredOn”}  $stats = Get-Stat -Realtime -Stat $metrics -Entity $vms -Start $start  $interval = $stats[0].IntervalSecs

 

$lunTab = @{}  foreach($ds in (Get-Datastore -VM $vms | where {$_.Type -eq “VMFS”})){   $ds.ExtensionData.Info.Vmfs.Extent | %{    $lunTab[$_.DiskName] = $ds.Name   }  }

 

$report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{   New-Object PSObject -Property @{    IOPSAvg = ($_.Group | `    Group-Object -Property Timestamp | `    %{$_.Group[0].Value + $_.Group[1].Value} | `    Measure-Object -Average).Average / $interval    VM = $_.Values[0]     Disk = $_.Values[1]     IOPSMax = ($_.Group | `      Group-Object -Property Timestamp | `      %{$_.Group[0].Value + $_.Group[1].Value} | `      Measure-Object -Maximum).Maximum / $interval    Datastore = $lunTab[$_.Values[1]]   }  }

 

$report | Export-Csv “C:IOPSMax-report.csv” -NoTypeInformation -UseCulture

 

____________________________________________________________

 

The output looks like this:

 

 

 

IOPSMax VM IOPSAvg Datastore Disk
1717.2 vsql67 754.8088235 VMFS02 naa.6006…
546.2 vbissrs25 68.51470588 VMFS37 naa.6002…
529.5 SQLC09N01 73.10625 VMFS14 naa.6002…
443.05 VBSSIS17 74.459375 VMFS12 naa.6002…
352.85 vsql65 77.44375 VMFS7 naa.6002… 

From here, you can go into the vSphere client and see how many reads and write you have going on. You can then position I/O intensive applications accordingly. There are many tools out there to measure IOPS, I just wanted to share this PowerCLI script. 

2 thoughts on “MAX IOPS within the last 5 minutes

  1. Hi

    I’m trying to use your script, but I keep getting the following error:
    Unexpected token ‘start’ in expression or statement.
    At C:\Users\905775\Desktop\IOPSdump.ps1:1 char:76
    + $metrics = “disk.numberwrite.summation”,”disk.numberread.summation” $start <<<< = Get-Date.AddMinutes(-5) $report = @()
    + CategoryInfo : ParserError: (start:String) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

    What's going wrong?

    Best regards, Daniel…

Leave a Reply

Your email address will not be published. Required fields are marked *