vdbench-磁盘/文件系统性能测试工具
vdbench 是一个 I/O 测试工具,可以用来测试磁盘和文件系统读写性能
centos7安装
1、java环境
[root@node1 ~]# yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip
[root@node1 ~]# java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
2、vdbench安装包(官网下载)
[root@node1 ~]# mkdir vdbench50407 && cd vdbench50407
[root@node1 ~]# unzip vdbench50407.zip
3、测试是否安装成功
[root@node1 vdbench50407]# ./vdbench -t
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Vdbench distribution: vdbench50407 Tue June 05 9:49:29 MDT 2018
For documentation, see 'vdbench.pdf'.
21:20:13.033 input argument scanned: '-f/tmp/parmfile'
21:20:13.251 Starting slave: /root/vdbench50407/vdbench SlaveJvm -m localhost -n localhost-10-230227-21.20.12.912 -l localhost-0 -p 5570
21:20:13.554 All slaves are now connected
21:20:16.002 Starting RD=rd1; I/O rate: 100; elapsed=5; For loops: None
Feb 27, 2023 interval i/o MB/sec bytes read resp read write read write resp queue cpu% cpu%
rate 1024**2 i/o pct time resp resp max max stddev depth sys+u sys
21:20:17.092 1 77.0 0.08 1024 51.95 0.021 0.015 0.027 0.03 0.05 0.009 0.0 10.1 5.6
21:20:18.017 2 88.0 0.09 1024 50.00 0.021 0.016 0.027 0.03 0.05 0.009 0.0 5.1 1.1
21:20:19.014 3 99.0 0.10 1024 49.49 0.021 0.015 0.026 0.03 0.05 0.009 0.0 5.4 1.5
21:20:20.017 4 78.0 0.08 1024 56.41 0.020 0.015 0.027 0.05 0.04 0.009 0.0 4.9 1.3
21:20:20.029
21:20:20.029 Message from slave localhost-0:
21:20:20.029 New messages found on /var/adm/messages. Do they belong to you?
21:20:20.030 /var/log/messages: Feb 27 21:20:15 node1 ceph-mgr: ::ffff:172.38.180.192 - - [27/Feb/2023:21:20:15] "HEAD / HTTP/1.1" 200 1162 """curl/7.29.0"
21:20:20.030 /var/log/messages: Feb 27 21:20:16 node1 ceph-mgr: ::ffff:172.38.180.192 - - [27/Feb/2023:21:20:16] "HEAD / HTTP/1.1" 200 1162 """curl/7.29.0"
21:20:20.030 /var/log/messages: Feb 27 21:20:18 node1 ceph-mgr: ::ffff:172.38.180.192 - - [27/Feb/2023:21:20:18] "HEAD / HTTP/1.1" 200 1162 """curl/7.29.0"
21:20:20.030 /var/log/messages: Feb 27 21:20:19 node1 ceph-mgr: ::ffff:172.38.180.192 - - [27/Feb/2023:21:20:19] "HEAD / HTTP/1.1" 200 1162 """curl/7.29.0"
21:20:20.030
21:20:21.021 5 96.0 0.09 1024 54.17 0.021 0.016 0.027 0.03 0.04 0.007 0.0 4.7 0.8
21:20:21.039 avg_2-5 90.3 0.09 1024 52.35 0.021 0.015 0.027 0.05 0.05 0.008 0.0 5.0 1.2
21:20:21.751 Vdbench execution completed successfully. Output directory: /root/vdbench50407/output
使用
1、准备一个待测试目录
[root@node1 ~]# mkdir /mnt/long
2、进入 vdbench 目录写配置文件(可参考example文件)
[root@node1 vdbench50407]# vim testdir.conf
fsd=fsd1,anchor=/mnt/long,depth=6,width=6,files=6,size=128k
fwd=fwd1,fsd=fsd1,operation=read,xfersize=4k,fileio=sequential,fileselect=random,threads=2
rd=rd1,fwd=fwd1,fwdrate=max,format=yes,elapsed=10,interval=1
messagescan=no
3、运行
[root@node1 vdbench50407]# ./vdbench -f testdir.conf
参数解释
1、fsd=fsd1,anchor=/mnt/long,depth=6,width=6,files=6,size=128k
fsd:唯一标识,文件系统存储定义
anchor:文件写入的根目录
depth:从/root/node-1目录开始,在其中创建6层深度的目录(深度)
width:从/root/node-1目录开始,每层目录创建6个平级目录(广度)
files:在使用depth和width创建的目录中,最深层每个目录创建6个文件
size:每个文件大小为128k
2、fwd=fwd1,fsd=fsd1,operation=read,xfersize=4k,fileio=sequential,fileselect=random,threads=2
fwd:唯一标识,文件工作负载定义
operation:值为read,表示每个线程,根据fileselect的值(这里是随机)选择一个文件后,打开该文件进行读取
xfersize:连续读取4k blocks(xfersize=4k)直到文件结束(size=128k),关闭文件并随机选择另一个文件
fileio:表示文件IO的方式,random或者sequential
fileselect:可选random或者sequential,值为random,表示每个线程随机选择一个文件
threads:值为2,表示启动2个线程(线程默认值为1)
3、rd=rd1,fwd=fwd1,fwdrate=max,format=yes,elapsed=10,interval=1
rd:唯一标识,运行定义
fwdrate:每秒有多少file system operations,max为无限制
format:值为yes,表示创建完整的目录结构,包括所有文件初始化到所需的128k大小
elapsed:持续运行时间,默认设置为30(以秒为单位)。注意:至少是interval的2倍,
interval:该参数指定每个报告间隔时间(以秒为单位)
4、messagescan=no
过滤掉多余的系统日志
补充:
hd:主机定义
sd:存储定义
wd:工作负载定义
查看目录结构
[root@node1 vdbench50407]# tree /mnt/long
/mnt/long/
├── no_dismount.txt
├── vdb.1_1.dir
│ ├── vdb.2_1.dir
│ │ ├── vdb.3_1.dir
│ │ │ ├── vdb.4_1.dir
│ │ │ │ ├── vdb.5_1.dir
│ │ │ │ │ ├── vdb.6_1.dir
│ │ │ │ │ │ ├── vdb_f0000.file
│ │ │ │ │ │ ├── vdb_f0001.file
│ │ │ │ │ │ ├── vdb_f0002.file
│ │ │ │ │ │ ├── vdb_f0003.file
│ │ │ │ │ │ ├── vdb_f0004.file
│ │ │ │ │ │ └── vdb_f0005.file
│ │ │ │ │ ├── vdb.6_2.dir
│ │ │ │ │ ├── vdb.6_3.dir
│ │ │ │ │ ├── vdb.6_4.dir
│ │ │ │ │ ├── vdb.6_5.dir
│ │ │ │ │ └── vdb.6_6.dir
│ │ │ │ ├── vdb.5_2.dir
多节点情况
多节点需要配置免密
配置文件如下 shared=yes:多节点压测同一共享目录时需要yes,相当于将目录划分区域各自压测所分配的区域 shared=no:默认为no,多节点无法压测同一共享目录
messagescan=no
hd=default,vdbench=/root/vdbench50407,user=root,shell=ssh
hd=hd1,system=node1
hd=hd2,system=node2
fsd=fsd1,anchor=/mnt/dir1,depth=1,width=1,files=20000,size=4KB,shared=no
fsd=fsd2,anchor=/mnt/dir2,depth=1,width=1,files=20000,size=4KB,shared=no
fwd=fwd1,fsd=fsd1,host=hd1,operation=write,xfersizes=4KB,fileio=sequential,fileselect=sequential,threads=40,openflags=directio
fwd=fwd2,fsd=fsd2,host=hd2,operation=write,xfersizes=4KB,fileio=sequential,fileselect=sequential,threads=40,openflags=directio
rd=rd1,fwd=fwd*,fwdrate=max,format=no,elapsed=300,interval=1