How to Stress Test the Hard Drives in Your PC or Server
Which of your hard drives is the fastest, and is it really as fast as the manufacturer promised? Whether you have a desktop PC or a server, Microsoft’s free Diskspd utility will stress test and benchmark your hard drives.
NOTE: A previous version of this guide explained using Microsoft’s old “SQLIO” utility. However, Microsoft now only offers the “Diskspd” utility, which replaces SQLIO, so we’ve updated this guide with brand new instructions.
Why Use Diskspd?
If you want to know the IO ability of your drives, Diskspd makes an excellent tool. Diskspd will tell you the maximum capacity a server’s hard drives can handle, or point you at the fastest hard drive you should use for heavy workloads (or just demanding PC gaming) on a desktop PC.As an example, let’s suppose that we have three drives on a server: an F drive, G drive and C drive. If we have our MDF on the F drive, the LDF on the G drive and our OS on our C drive, we can evaluate whether our setup is effective. For example, if the MDF file is the busiest file with the most reads and writes, we’d want it to be on the fastest drive.
Using the above example with the graphs (representing the writes and reads for the OS, LDF and MDF), we would place our MDF file on the fastest drive since our MDF is the busiest. If our Diskspd analysis showed that F was our fastest drive, we would place our MDF file on drive F.
Where to Download Diskspd
Diskspd has been tested to work on desktop versions of Windows 7, 8, 8.1, 10, as well as Windows Server 2012, 2012 R2, and 2016 Technical Preview 5.
Once you’ve downloaded it, you’ll need to extract the contents of the .zip file to a folder on your computer. Note that the archive contains three different “diskspd.exe” files. The one in the “amd64fre” folder is for 64-bit Windows PCs, while the one in the “x86fre” folder is for 32-bit Windows PCs. If you’re using a 64-bit version of Windows, and you probably are, you’ll likely want to use the 64-bit version.
How Do I Perform a Stress Test?
First, use cd to switch to the directory containing the Diskspd.exe you want to use:
cd c:\path\to\diskspd\amd64fre
In our case, that looked like the command below.
Now, run the Diskspd command with the options you want to use. You’ll find a complete list of command line options and usage information in the 30-page DiskSpd_Documentation.pdf file included in the Diskspd archive you downloaded.
However, if you want to get up and running quickly, here’s an example command. The following command sets the block size to 16K (-b16K), runs a 30 second test (-d30), disables hardware and software cashing (-Sh), measures latency statistics (-L), uses two IO requests per thread (-o2) and four threads (-t4) per target, uses random access rather than sequential writing (-r), performs 30% write operations and 70% read operations (-w30).
It creates a file at c:\testfile.dat of 50 MB in size (-c50M). If you wanted to benchmark your D: drive instead, for example, you’d specify d:\testfile.dat
Diskspd.exe -b16K -d90 -Sh -L -o2 -t4 -r -w30 -c50M c:\testfile.dat
After however long you specify–30 seconds in the above test–the test results will be printed to the Command Prompt and you can view them.
Consult the results and you’ll see the average MB/s the drive reached during the test–how many write operations were performed a second, how many read operations were performed a second, and the total amount of input/output (IO) operations per second. These statistics are most useful when comparing multiple drives to see which is faster for certain operations, but they’ll also tell you exactly how much IO a hard drive can handle.
You can also dump the results to a text file you can view later with the > operator. For example, the below command runs the same command as above and places the results in the C:\testresults.txt file.
Diskspd.exe -b16K -d90 -Sh -L -o2 -t4 -r -w30 -c50M c:\testfile.dat > c:\testresults.txt
Repeat this process for your other drives, and compare.
Customizing Your Stress Test Command
Note that there are many, many other command line options you can specify for Diskspd.exe. You’ll find the most complete, up-to-date list in the documentation that comes with the downloaded Diskspd.exe file itself, but here are some important options:
- -w denotes percentage of write and read operations. For example, entering -w40 will perform 40% write operations and thus 60% read operations. Entering -w100 will perform 100% write operations. Omitting the -w switch or entering -w0 will perform 0% write operations and thus 100% read operations.
- -r or -s determines whether the test uses either random access or sequential operations. Specify -r for random access or -s for sequential. This helps you test for either random file access (often a bunch of small files) or sequential file access (often one large file that’s read or written all at once).
- -t denotes number of threads that will be run at the same time, such as -t2 for two threads or -t6 for six threads.
- -o denotes number of outstanding requests per thread, such as -o4 for four requests or -o2 for two results.
- -d is the duration of the tests in seconds, such as -d90 for 90 seconds or -d120 for 120 seconds.
- -b is the block size of the reads or writes, such as -b16K for a 16K block size or -b64K for a 64K block size.
Using these options, you can tweak the benchmark command to see how your disk performs under varying loads. Once you’ve written a command that you feel approximates the type of workload you perform on your PC, you can stress test several drives and see which offers the best performance.
No comments:
Post a Comment