diskspd测试Windows硬盘的读写速度

0    179    2

Tags:

👉 本文共约7427个字,系统预计阅读时间或需28分钟。

简介

DISKSPD 是一个可生成 I/O 的命令行工具,用于微基准测试。 Diskspd 是微软开源的磁盘性能基准测试工具,其基于命令行界面,有非常多的测试参数可用,很强大。

名称内容
开发语言C++
界面框架无(在cmd中执行命令)
代码量1万行
支持系统Windows
官网地址https://github.com/Microsoft/diskspd/wiki
github地址https://github.com/microsoft/diskspd
软件下载地址https://github.com/microsoft/diskspd/releases/download/v2.1/DiskSpd.ZIP

GitHub:https://github.com/microsoft/diskspd

wiki:https://github.com/Microsoft/diskspd/wiki

测试的目标可以是文件、分区、物理驱动器中的任意一个维度。这三种的区别,就是测试范围是一个比一个大的,文件<分区<物理驱动器。

  • 测试文件时,表示测试只针对这个文件,不管其在哪个分区或驱动器上;
  • 测试分区时,表示只会在这个分区上读写,不会影响其他分区文件;
  • 测试驱动器时,表示只会在这个驱动器上读写,不会影响其他驱动器。

安装

直接下载安装包,解压即可。

  • amd64: For 64 bit operating systems
  • x86: For 32 bit operating systems
  • ARM64: For 32 bit operating systems

帮助

参数说明

最常用参数介绍:

参数名说明
-b [K|M|G]表示块大小(以字节、KiB、MiB 或 GiB为单位),默认块大小为 64 KiB。
-c[K|M|G|b]设置测试中创建使用的示例文件大小。 可以按字节、KiB、MiB、GiB 或块进行设置。
-D捕获 IOPS 统计信息(例如标准偏差),时间间隔为毫秒[default=1000,1second]。
-d指定测试的持续时间,不包括冷却或预热时间。 默认值为 10 秒,但对于任何繁重的工作负荷,建议至少使用 60 秒。
-L度量延迟统计信息。
-o表示每个线程的每个目标的未完成 I/O 请求数, 也称为队列深度。
-r[K|M|G|b]随机 I/O 对齐测试,默认值为4K,不加-r为顺序I/O测试。
-Suw禁用软件和硬件写入缓存(等效于 -Sh)。
-t表示每个目标的线程数,默认是单线程。
-w指定属于写入请求操作的百分比(不写-w或-w或者-w0 等效于100%读取)。 如:-w25代表有25%的写,75%的读。

diskspdming命令参数说明:

-o 用于设置每个目标线程的未完成 I/O 请求的数。1表示进程同步,2表示进程异步。
-b[K|M|G] 表示测试的块大小(以字节、KiB、MiB 或 GiB为单位),默认块大小为 64 KiB。
-r[K|M|G] 随机 I/O 对齐测试,默认值为4K,不加-r为顺序I/O测试。
-w 用于指定写入请求的百分比,默认写入请求为读取请求的 100%。50%-表示读写测试各50%
-d 用于指定测试时长,默认为 10 秒(不包括冷却和预热时间)
-Sh 禁用软件和硬件写入缓存
-D 捕获 IOPS 统计信息(例如标准偏差),时间间隔为毫秒[default=1000,1second]。
-L 度量延迟统计信息。
-c[K|M|G|b] 设置测试中创建使用的示例文件大小。 可以按字节、KiB、MiB、GiB 或块进行设置。

其它参数:

Sample command lines

Note that there also some additional examples in Section 3 when describing more complex options.

Test descriptionSample command
Large area random concurrent reads of 4KB blocksdiskspd -c2G -b4K -F8 -r -o32 -W60 -d60 -Sh testfile.dat
Large area random concurrent writes of 4KB blocksdiskspd -c2G -w100 -b4K -F8 -r -o32 -W60 -d60 -Sh testfile.dat
Large area random serial reads of 4KB blocks.diskspd -c2G -b4K -r -o1 -W60 -d60 -Sh testfile.dat
Large area random serial writes of 4KB blocksdiskspd -c2G -w100 -b4K -r -o1 -W60 -d60 -Sh testfile.dat
Large area sequential concurrent reads of 4KB blocksdiskspd -c2G -b4K -F8 -T1b -s8b -o32 -W60 -d60 -Sh testfile.dat
Large area sequential concurrent writes of 4KB blocksdiskspd -c2G -w100 -b4K -F8 -T1b -s8b -o32 -W60 -d60 -Sh testfile.dat
Large area sequential serial reads of 4KB blocksdiskspd -c2G -b4K -o1 -W60 -d60 -Sh testfile.dat
Large area sequential serial writes of 4KB blocksdiskspd -c2G -w100 -b4K -o1 -W60 -d60 -Sh testfile.dat
Small area concurrent reads of 4KB blocksdiskspd -c100b -b4K -o32 -F8 -T1b -s8b -W60 -d60 -Sh testfile.dat
Small area concurrent writes of 4KB blocksdiskspd -c100b -w100 -b4K -o32 -F8 -T1b -s8b -W60 -d60 -Sh testfile.dat
Display statistics about physical disk I/O and memory events from the NT Kernel Loggerdiskspd -eDISK_IO -eMEMORY_PAGE_FAULTS testfile.dat
Specify 90% of I/O to 10% of the target, 0% of I/O to the next 10% of the target, 5% of I/O to the next 20% of target and the remaining 5% of I/O to the remaining 60% of target (implied), using -rdpct.diskspd -c1G -b4K -r -o32 -w0 -d60 -Sh -rdpct90/10:0/10:5/20 testfile.dat
Specify 90% of I/O to 10GiB of the target, 0% of I/O to the next 10GiB, 5% of I/O to the next 20GiB and the remaining 5% of I/O to the remaining target file size, using -rdabs.diskspd -c1G -b4K -r -o32 -t1 -w0 -d60 -Sh -rdabs90/10G:0/10G:5/20G testfile.dat
Mix random and sequential workloads (20% random and 80% sequential I/O)diskspd -c1G -b4K -o32 -t1 -r8b -w50 -rs20 -d60 -Sh testfile.dat
Limit IOPS to 1000 per threaddiskspd -c1G -b4K -o32 -t1 -w50 -g1000i -d60 -Sh testfile.dat
Create a text profile from a set of parametersdiskspd -t1 -o4 -b4k -r4k -w0 -Sh -D -d60 -L -c1G -Rptext > profile.txt
Create an XML profile from a set of parametersdiskspd -t1 -o4 -b4k -r4k -w0 -Sh -D -d60 -L -c1G -Rpxml *1 *2 > profile.xml
Substitute target files from a previously created XML profile (see above)diskspd -Xprofile.xml file1.dat, file2.dat

测试

如下命令:

其各参数含义:

  • c64M,创建测试文件大小为64MB
  • b64K,块大小为64KB,即读写过程中每一个IO请求操作的数据大小为64KB
  • t1,每个目标的线程数,即测试D:\test.dat文件使用线程数为1
  • o32,队列深度,即内部IO请求队列的最大容量为32
  • si64K,IO操作步进偏移大小
  • w50,写请求的百分比,即写IO比例50%,读IO比例50%
  • S,禁用软件缓存,采用此选项时,测出的结果更接近实际硬件速度;若启用了缓存,则测试结果会大大高于实际硬件速度。

按上述参数创建测试文件D:\test.dat,并进行测试,默认测试时间持续10s。

示例

  • 使用2个线程和1个未完成的IO进行4KB顺序写入
  • 使用2个线程和1个未完成的IO进行64KB顺序写入
  • 8KB随机读取使用2个线程,1个未完成的IO
  • 使用2个线程和1个未完成的IO进行128KB随机读取

测试结果解读

img

  • thread:生成IO的线程的编号
  • bytes:为测试传输的总字节数
  • I/Os:为测试执行的IO操作总数
  • MB/s:吞吐量,以MB /秒为单位
  • I/O per s:每秒的IO操作数
  • AvgLat:测试的所有IO操作的平均延迟
  • IopsStdDev:每秒IO操作的标准偏差
  • LatStdDev:测试遇到的延迟的标准偏差
  • file:IO测试中使用的文件的路径

img

99.9%[3-nines]的write操作延时为0.083,还是比较好的。

Microsoft建议日志延迟应该在1-5ms到数据延迟应该在4-20ms之间。

输出的四个主要部分:

  1. 输入设置

    此部分介绍你运行的命令、输入参数以及有关测试运行的其他详细信息。

    示例输出显示了命令和输入参数。

  2. CPU 使用率详细信息

    此部分重点介绍测试时间、线程数、可用处理器数,以及测试期间每个 CPU 核心的平均使用率等信息。 在此示例中,有两个 CPU 核心的平均使用率大约为 4.67%。

    示例 CPU 详细信息。

    本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
    AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
    验证码:
    获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复