Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd

Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd

A properly configured SQL Server is like a well tuned race engine.

“We need faster storage.” Sound familiar? Or what about “No, the storage is good; we need to tune the database.” Often teams will have very different opinions about the root cause of a performance issue. Microsoft’s free DiskSpd utility can help identify disk I/O performance issues for your SQL server systems.

Here’s a short introduction video for how DiskSpd can be used to gather the necessary performance metrics without using the SQL Server Dynamic Management Views (DMVs). Having a way to support your case without using SQL Server to capture these metrics can sometimes be helpful.

Using DiskSpd on Your SQL Server System

Using Diskspd we can benchmark the raw performance of storage without relying on SQL Server DMV information at all. It’ll report on write and read latency, on sequential and random disk activity. It’s very granular and can be extremely insightful.

For example, I downloaded the utility and ran it on my laptop using the following command.

Diskspd.exe -b8K -d60 -h -L -o2 -t4 -r -w30 -c100M c:\test\io.dat > c:\test\output.txt

In this simple case, I set the block size to 8K using the -b parameter, ran the test for 60 seconds using the -d parameter, disabled hardware and software caching with the -h parameter, measured latency statistics with -L, used 2 overlapped IOs with the -o parameter, created 4 threads per target with the -t parameter, defined a workload of random input/output with the -r parameter, defined 30% of the I/O to be writes with the -w parameter, had the utility create a 100MB test file at c:\test\io.dat, and configured the output to be written to c:\test\output.txt.

There are many more parameters available in DiskSpd. For a complete list, run DiskSpd -?.

Interpreting the DiskSpd Disk I/O Performance Results

In my case, I received the following results in the c:\test\output.txt file. Keep in mind this is on a laptop and not a production SQL Server.


Command Line: Diskspd.exe -b8K -d60 -h -L -o2 -t4 -r -w30 -c100M c:\test\io.dat

Input parameters:

	timespan:   1
	-------------
	duration: 60s
	warm up time: 5s
	cool down time: 0s
	measuring latency
	random seed: 0
	path: 'c:\test\io.dat'
		think time: 0ms
		burst size: 0
		software cache disabled
		hardware write cache disabled, writethrough on
		performing mix test (read/write ratio: 70/30)
		block size: 8192
		using random I/O (alignment: 8192)
		number of outstanding I/O operations: 2
		thread stride size: 0
		threads per file: 4
		using I/O Completion Ports
		IO priority: normal

System information:

	computer name: DESKTOP-K9DJS56
	start time: 2020/10/21 14:18:01 UTC

Results for timespan 1:
*******************************************************************************

actual test time:	60.00s
thread count:		4
proc count:		4

CPU |  Usage |  User  |  Kernel |  Idle
-------------------------------------------
   0|  71.35%|  13.26%|   58.10%|  28.65%
   1|  66.28%|  15.23%|   51.04%|  33.72%
   2|  70.03%|  13.41%|   56.61%|  29.97%
   3|  68.15%|  17.73%|   50.42%|  31.85%
-------------------------------------------
avg.|  68.95%|  14.91%|   54.04%|  31.05%

Total IO
thread |       bytes     |     I/Os     |    MiB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |      4398579712 |       536936 |      69.91 |    8948.90 |    0.222 |     0.740 | c:\test\io.dat (100MiB)
     1 |      4435599360 |       541455 |      70.50 |    9024.22 |    0.221 |     0.739 | c:\test\io.dat (100MiB)
     2 |      4433772544 |       541232 |      70.47 |    9020.50 |    0.221 |     0.757 | c:\test\io.dat (100MiB)
     3 |      4367548416 |       533148 |      69.42 |    8885.77 |    0.224 |     0.787 | c:\test\io.dat (100MiB)
-----------------------------------------------------------------------------------------------------
total:       17635500032 |      2152771 |     280.31 |   35879.40 |    0.222 |     0.756

Read IO
thread |       bytes     |     I/Os     |    MiB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |      3077742592 |       375701 |      48.92 |    6261.66 |    0.256 |     0.669 | c:\test\io.dat (100MiB)
     1 |      3101097984 |       378552 |      49.29 |    6309.18 |    0.256 |     0.751 | c:\test\io.dat (100MiB)
     2 |      3100819456 |       378518 |      49.29 |    6308.61 |    0.254 |     0.606 | c:\test\io.dat (100MiB)
     3 |      3055476736 |       372983 |      48.57 |    6216.36 |    0.258 |     0.715 | c:\test\io.dat (100MiB)
-----------------------------------------------------------------------------------------------------
total:       12335136768 |      1505754 |     196.06 |   25095.82 |    0.256 |     0.688

Write IO
thread |       bytes     |     I/Os     |    MiB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |      1320837120 |       161235 |      20.99 |    2687.24 |    0.144 |     0.879 | c:\test\io.dat (100MiB)
     1 |      1334501376 |       162903 |      21.21 |    2715.04 |    0.139 |     0.702 | c:\test\io.dat (100MiB)
     2 |      1332953088 |       162714 |      21.19 |    2711.89 |    0.144 |     1.023 | c:\test\io.dat (100MiB)
     3 |      1312071680 |       160165 |      20.85 |    2669.41 |    0.145 |     0.928 | c:\test\io.dat (100MiB)
-----------------------------------------------------------------------------------------------------
total:        5300363264 |       647017 |      84.25 |   10783.58 |    0.143 |     0.890



total:
  %-ile |  Read (ms) | Write (ms) | Total (ms)
----------------------------------------------
    min |      0.054 |      0.048 |      0.048
   25th |      0.168 |      0.082 |      0.121
   50th |      0.192 |      0.095 |      0.174
   75th |      0.228 |      0.113 |      0.211
   90th |      0.337 |      0.144 |      0.292
   95th |      0.557 |      0.203 |      0.454
   99th |      1.394 |      0.610 |      1.291
3-nines |      4.510 |     14.778 |      5.577
4-nines |     18.031 |     26.059 |     20.629
5-nines |    117.426 |    117.574 |    117.502
6-nines |    153.091 |    161.708 |    153.091
7-nines |    162.048 |    161.708 |    162.048
8-nines |    162.048 |    161.708 |    162.048
9-nines |    162.048 |    161.708 |    162.048
    max |    162.048 |    161.708 |    162.048

As you can see, DiskSpd creates quite a bit of information.

According to the results, the test consumed nearly 69% of the CPU resources. As for the latency, the last section shows the metrics broken down by percentiles. In my case, the minimum read latency was 0.054 ms and the best write latency I could achieve was 0.048 ms. The maximum latencies were read 162.048 ms and write 161.708 ms. At the 50th percentile, my system had a read latency of 0.192 ms and a write latency of 0.095 ms.

This output can help you determine whether the disk I/O subsystem is delivering the performance your SQL Server system needs.

Where to Get DiskSpd

DiskSpd is available on GitHub, and additional how-to documentation can be found on TechNet here.

For other checks to run on your SQL Server system, check out Is My SQL Server Configured Properly.

 

2 Responses

  1. […] Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd […]

  2. […] address those claims, check out Identify Disk I/O Performance Issues for Your SQL Server Using DiskSpd. That tool completely removes SQL Server from the discussion and objectively tests the disk […]

Leave a Reply

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