The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

PowerShell is King – Measure disk performance for IOPS and Transfer rate

Posted by Mikael Nystrom on April 2, 2014

The need

Since I build datacenters I need to verify performance and you can do that using SQLIO. But there is a lot of parameters, a lot of typing and to make testing a bit more consistent I was reading Jose Barreto’s blog http://blogs.technet.com/b/josebda/archive/2013/03/28/sqlio-powershell-and-storage-performance-measuring-iops-throughput-and-latency-for-both-local-disks-and-smb-file-shares.aspx and that gave me inspiration to create a PowerShell script that is a bit more complete and here you can see the result of it. We use this to measure performance on local disks, SMB storage, Storage Spaces, SAN storage, iSCSI storage, basically everything, now it is easy to “spot” the issue, since we have seen the numbers so many times.

Measure-DiskPerformance - pic01

Output sample in table format.

Measure-DiskPerformance - pic02

Output in Grid view.

The Download

You can download the script from here: http://1drv.ms/1pQNr4i

To use it you need to have SQLIO from Microsoft and you need to store the SQLIO.exe file in the same folder as the script, this way it is easy to move around the test tool as a kit, since SQLIO does not really needs to be installed, the download is an MSI file, so you need to install it once or extract it

You can download SQLIO from here: http://www.microsoft.com/en-us/download/details.aspx?id=20163

The script it is rather easy, it is basically a wrapper for SQLIO.exe but it gives you an output as a table or in a grid. There is two options to measure workload, you either measure IOPS or Transfer rate.

The howto

.\Measure-DiskPerformance.ps1 -TestFileName test.dat –TestFileSizeInGB 1 -TestFilepath C:\VMs -TestMode Get-LargeIO -FastMode True -RemoveTestFile True -OutputFormat Out-GridView

Explanation:

-TestFileName test.dat

The name of the file, it will create the file using FSUTIL, but it checks if it exists and if it does it stops, you can override that with the –RemoveTestFile True

–TestFileSizeInGB 1

Size of the file, it has fixed values, use the TAB key to flip through them

-TestFilepath C:\VMs

The folder, can also be an UNC path, it will create the folder so it does not need to exist.

-TestMode Get-LargeIO

There is too test modes Get-LargeIO or Get-SmallIO, you use Get-LargeIO to measure the transfer rate and you use Get-SmallIO to measure IOPS

-FastMode True

Fastmode true runs each test for just 10 seconds, it gives you a hint, if you don’t set it or set it to false it will run for 60 sec (it will take a break for 10 sec between each run)

-RemoveTestFile True

Removes the test file if it exists

-OutputFormat Out-GridView

Choose between Out-Gridview or Format-Table

/mike

37 Responses to “PowerShell is King – Measure disk performance for IOPS and Transfer rate”

  1. CLParker said

    Reblogged this on MDTGuy.WordPress.com and commented:
    Powershell Por Vida! Another excellent post from Mikael Nystrom!

  2. […] https://deploymentbunny.com/2014/04/02/powershell-is-kingmeasure-disk-performance-for-iops-and-transf… […]

  3. CypherBit said

    Can this be used on CSVs as well? Any limitations?

  4. Arwidmark writes the following on his blog. Comment? “And please do not create the file using FSUtil, because it will just create an empty file, which the controller cache may suck into RAM immediately and your test results will be off the charts. Create a “real” file, with content, generate a giant ISO file, or a large WinRAR archive, anything you can think of as long as the file is full with data.”

    • Yep, I know, we disagree on that. I have come to the conclusion that it does not matter much as long as you use the same method everytime. But when using FSUTIL you must run it twice, the first time to create the file and the second to fill it with data, if you run it only once it will 100% empty

  5. Anders said

    Could this script be used to measure disk performance inside a Virtual Machine ?
    Or is just for Hyper-V hosts ?
    Tips for measure diskspeed inside a VM?
    /Anders

    • Yes, we use it inside VM as well..

      • Anders said

        Ok, great! What is “normal” values for different types of disksetups (SSD, SAS-Mirror, SATA-III ? would be great with som kind of list. I Ran the script within a VM where the vhdx is on SATA-3 mirror (storage spaces in 2012 R2) and got 7000MB and 13000 IOPs. That could not be correct I think? Runing on the host towards the same storage got me around 90MB and 200 IOPs. And towards a SSD-storage got me 535 MB/Sec and 1050 IOPs on the same host.

      • That cpould be correct, since the the fabric layer will try to not do anything pointless, it vill use cache and similar functions to avoid unneeded actions. But we have another script that will better simulate real load. (will post as soon as I have 5 minutes to spare)

      • Anders said

        Hi Mike!
        Have you found 5 minutes to spare, so that you could upload that other script for better testing disk performance inside a VM?
        /Anders

  6. Martin A. said

    Awesome script! As Anders said, you get that script for testing within a VM uploaded?
    Thanks.

  7. Lee D said

    Would be great to see that other script once you have uploaded it. I also have a requirement for testing against different types of storage.

  8. John said

    I’m having this issue while running the script,

    Method invocation failed because [System.Object[]] doesn’t contain a method named ‘Split’.
    At C:\PS\Measure-DiskPerformance.ps1:120 char:25
    + $mbs = $Result.Split <<<< ("`n")[11].Split(':')[1].Trim()
    + CategoryInfo : InvalidOperation: (Split:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    any advice on to resolve the error?

    • No, not really. Try to run it on any other machine, with an other OS and see if the same thing happens. The error does not make any sense at all

    • Hans Bruman said

      I ran into the same problem while doing some testing of my own. I think that it was a powershell version issue and that the resolution was to remove the first split (.Split(“`n”)), it seems that the output already was delivered by line.

      • Rudi Wiesmayr, IKT Linz, Austria said

        As I wanted to test the performance of an old 2003 Server I hacked the script so that it now runs on PowerShell Version 2 with Format-Table

  9. […] This Powershell wrapper is written by Mikael Nyström, Microsoft MVP. Link to his website is here. […]

  10. […] found a PowerShell script that will test and output figures.  For details on the script, follow this link.  For testing IOPS you’ll want to make sure you specify Get-SmallIO in the command, […]

  11. […] me, so i wanted to test IOPS performance. For this i choose SQLIO and the powershell script by Mikael Nystrom. As it says on the website the powershell script uses SQLIO to perform IO tests on the selected […]

  12. agileio said

    Reblogged this on Agile I/O and commented:
    I just had to share this. Great script, valuable resource indeed!

  13. […] a wrapper script for SQLIO that was heavily based upon previous work from both Jose Baretto & Mikael Nystrom. Adaptations were made to make it a bit more clean in code and to have a back-end for visualization […]

  14. Zach said

    I am seeing this error in PS and the throughput and IOPS do not populate
    Method invocation failed because [System.Object[]] doesn’t contain a method named ‘Split’.

  15. Prolexic said

    What if i want to run this for a long period of time ? Say 3 days and get results summing up the iops need ?

  16. SQLIO no longer available, has been replaced by DiskSpd: https://gallery.technet.microsoft.com/DiskSpd-a-robust-storage-6cd2f223

    The original download link for SQLIO now points at a PDF which states:

    “The SQLIO Disk Subsystem Benchmark Tool has been retired and replaced by
    DiskSpd.exe. You can download the tool and documentation
    from http://aka.ms/diskspd. DiskSpd.exe is a versatile storage load generator and
    performance tool from Microsoft that can be used to run storage performance
    tests against files, partitions, and physical disks. It can simulate SQL Server I/O
    activity or more complex, variable access patterns.
    DISKSPD is provided “as is,” and no support is offered for any problems
    encountered when using the tool. Please see the EULA.doc for the DiskSpd
    license agreement.”

  17. Steve Burkett said

    The SQLIO download has been pulled by Microsoft and replaced with a Readme.PDF which says ‘The SQLIO Disk Subsystem Benchmark Tool has been retired and replaced by DiskSpd.exe.’ Bummer.

  18. […] have found a PowerShell script (by Mikael Nystrom, Microsoft MVP), which is essentially an add-on to SQLIO.exeutility(a set of […]

  19. […] You may choose any standard benchmark testing tools. To keep it simple, I have used a PowerShell script authored by Mikael Nystrom, Microsoft MVP. This script is a wrapper to the SQLIO.exe. You may […]

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: