How I test disk performance

Sam Rueby Uncategorized 0 Comments

Testing disk performance is not a trivial task. And I’m not an authoritative source on how to do it. However that doesn’t mean I can’t try to be!

The reason that testing disk performance isn’t trivial is because it depends on what you care about. “What do you mean? I want to know if my disk is fast or slow.” Okay. Fast or slow doing what? There are a few different workloads that hard drives tend to handle, and they may handle them better or worse depending on the type of disk (magnetic, solid state, SD card) and the arrangement it’s in (by itself, (hardware or software) RAID-0, RAID-1, etc). Here are a few of those types:

  • Reading
  • Writing

Paired with:

  • Sequential data
  • Random data

Paired with:

  • Small amount of data
  • Large amount of data

It gets even trickier when you turn “large” or “small” into an actual amount because the most-optimal amount can be somewhere in the middle, so we’re not going to get into that. The method I use is great for obtaining some worthy numbers that allow you to compare two disks on your machine, or if upgrading a particular disk actually benefited you.

So let’s get to it. I use SQLIO. You can download it here: http://www.microsoft.com/en-us/download/details.aspx?id=20163 . This is the perfect little tool for getting an idea of the disk performance in your system. The unfortunate part is understanding all of the configuration combinations this program is capable of. Here are the steps:

  1. Install SQLIO from the link above. It has a really small footprint: I don’t know why it’s not just a simple exe.
  2. First, you have to generate a test file.
    To do this, navigate to SQLIO’s installation folder, which by default is C:Program Files (x86)SQLIO. Open up param.txt. The defaults in here should be kept the same, except make sure that the location of testfile.dat is on the hard drive you actually want to test. If that drive is C:, then keep this as C:testfile.dat.
  3. Now you have to navigate to SQLIO’s installation folder in an administrative command prompt. I quickly do this by pressing Windows key, “cmd”, CTRL+Shift+Enter, which will run cmd with administrative rights. cd to C:Program Files (x86)SQLIO. Now run the command sqlio -kW -s5 -fsequential -o4 -b64 -Fparam.txt. This will generate the file specified in param.txt.
  4. Next we’re going to save a script that will test many of the above “workload types”. Create a file in this directory named RunTests.bat. The contents of this file will be:

    echo %DATE% %TIME%

    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s10 -frandom -o8 -b8 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -frandom -o8 -b64 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -frandom -o8 -b128 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -frandom -o8 -b256 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -fsequential -o8 -b8 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -fsequential -o8 -b64 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -fsequential -o8 -b128 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kW -s360 -fsequential -o8 -b256 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -frandom -o8 -b8 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -frandom -o8 -b64 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -frandom -o8 -b128 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -frandom -o8 -b256 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -fsequential -o8 -b8 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -fsequential -o8 -b64 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -fsequential -o8 -b128 -LS -Fparam.txt
    timeout /T 60
    "C:Program Files (x86)SQLIOsqlio.exe" -kR -s360 -fsequential -o8 -b256 -LS -Fparam.txt

    echo %DATE% %TIME%

  5. Now, in the administrative command prompt, run RunTests.bat > results1.txt
  6. The script intentionally has minute pauses in order to rest the drive so each test is fair. Because of this, it will take at least 15 minutes to run.
  7. After the tests are complete, results1.txt will contain all of the output, allowing you to see how the disk performed for each test.
  8. You can now delete testfile.dat that was created in the location as specified in param.txt.

At this point you can read the results file and determine how your disk performed. Notice the differences when using sequential and random data, reading and writing, with small and large data.

Disclaimer: I’ve had that script for so long that I don’t know where it originally came from. If it’s yours, let me know and I’ll link it back.