sysbench利用fabric磁盘IO测试

简介:

利用sysbench测试磁盘IO:

10台机器并发测试,一台fabric控制server,控制端需要安装fabric,测试server安装sysbench,测试时生成15G的测试文件;测试案例如下:

fabric的远程管理,可以看一下上篇博文:

http://xujunxian.blog.51cto.com/8614409/1730780

wKioL1aNLgnw_r2VAABobql7Gcc621.png

测试执行:

1、创建11台ubuntu台虚拟机,1台安装fabric,10台安装sysbench,并配置好IP地址,fabric需要直接访问安装sysbench的机器

2、将脚本fabric.py 拷贝至fabric服务器中,并运行命令:

fab sysbench>fabric.log测试完成后根据生成日志填入测试表中(填写10台总io)

脚本如下:

vim fabfile.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from fabric.api  import  run
from fabric.context_managers  import  env
from fabric.context_managers  import  cd
 
env .hosts = [ '10.32.32.30' , '10.32.32.31' , '10.32.32.32' , '10.32.32.33' , '10.32.32.34' , '10.32.32.35' , '10.32.32.36' , '10.32.32.37' , '10.32.32.38' , '10.32.32.39' ]
env .user =  'root'
env .password =  '1qaz@WSX'
env .parallel = True
 
def host_type():
     run( 'uname -s && ls -alh' )
 
def sysbench():
     with  cd ( '/home/' ):
           run( 'echo block 512 threads=1 mode=rndrd' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=32 mode=rndrd' )                                                          
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=1 mode=rndrd' )     
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=32 mode=rndrd' )     
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=1 mode=rndrd' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=32 mode=rndrd' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrd run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=1 mode=rndrw' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=32 mode=rndrw' )                                                          
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=1 mode=rndrw' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=32 mode=rndrw' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=1 mode=rndrd' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=32 mode=rndrd' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrw run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=1 mode=rndrd flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=32 mode=rndrd  flag=direct' )                                                          
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=1 mode=rndrd  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=32 mode=rndrd  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=1 mode=rndrd  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=32 mode=rndrd  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrd --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )     
           
           run( 'echo block 512 threads=1 mode=rndrw flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrw --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 512 threads=32 mode=rndrw  flag=direct' )                                                         
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=512 --init-rng=on --file-total-size=15G --file-test-mode=rndrw --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=1 mode=rndrw  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrw --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 4096 threads=32 mode=rndrw  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=4096 --init-rng=on --file-total-size=15G --file-test-mode=rndrw  --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 565536 threads=1 mode=rndrw  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=1 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrw --file-extra-flags=direct run'  )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )
           
           run( 'echo block 65536 threads=32 mode=rndrw  flag=direct' )
           run( 'sysbench --test=fileio --file-total-size=15G prepare' )
           run( 'sysbench --max-time=300 --max-requests=0 --test=fileio --num-threads=32 --file-block-size=65536 --init-rng=on --file-total-size=15G --file-test-mode=rndrw  --file-extra-flags=direct run' )
           run( 'sysbench --test=fileio --file-total-size=15G cleanup' )

参数详解:

sysbench --max-time=300 测试时间5分钟,不用更改

--num-threads=1  测试进程,更需需要测试的项目进行更改

--file-block-size=512 块儿大小,需要根据测试需求更改

Rndrd 为随机读,rndrw为随机读写,根据需求测试

--file-extra-flags=direct 根据测试需求添加

--file-num=N          代表生成测试文件的数量,默认为128。

--file-block-size=N      测试时所使用文件块的大小,如果想磁盘针对innodb存储引擎进行测试,可以将其设置为16384,即innodb存储引擎页的大小。默认为16384。

--file-total-size=SIZE     创建测试文件的总大小,默认为2G大小。

--file-test-mode=STRING 文件测试模式,包含:seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)。

--file-io-mode=STRING   文件操作的模式,sync(同步),async(异步),fastmmap(快速mmap),slowmmap(慢速mmap),默认为sync同步模式。

--file-async-backlog=N   对应每个线程队列的异步操作数,默认为128。

--file-extra-flags=STRING 打开文件时的选项,这是与API相关的参数。

--file-fsync-freq=N      执行fsync()函数的频率。fsync主要是同步磁盘文件,因为可能有系统和磁盘缓冲的关系。 0代表不使用fsync函数。默认值为100。

--file-fsync-all=[on|off]  每执行完一次写操作,就执行一次fsync。默认为off。

--file-fsync-end=[on|off] 在测试结束时执行fsync函数。默认为on。

--file-fsync-mode=STRING文件同步函数的选择,同样是和API相关的参数,由于多个操作系统对于fdatasync支持不同,因此不建议使用fdatasync。默认为fsync。

--file-merged-requests=N 大多情况下,合并可能的IO的请求数,默认为0。

--file-rw-ratio=N         测试时的读写比例,默认时为1.5,即可3:2。






      本文转自Jx战壕  51CTO博客,原文链接:http://blog.51cto.com/xujpxm/1732311,如需转载请自行联系原作者




相关文章
|
2月前
|
SQL
南大通用GBase 8a配置gcware日志等级,减少日志输出,节省磁盘IO
南大通用GBase 8a配置gcware日志等级,减少日志输出,节省磁盘IO
|
3月前
|
关系型数据库 MySQL 测试技术
【赵渝强老师】MySQL的基准测试与sysbench
本文介绍了MySQL数据库的基准测试及其重要性,并详细讲解了如何使用sysbench工具进行测试。内容涵盖sysbench的安装、基本使用方法,以及具体测试MySQL数据库的步骤,包括创建测试数据库、准备测试数据、执行测试和清理测试数据。通过这些步骤,可以帮助读者掌握如何有效地评估MySQL数据库的性能。
174 5
|
3月前
|
存储 关系型数据库 MySQL
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
1456 2
|
5月前
|
存储 关系型数据库 MySQL
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
313 5
|
6月前
|
NoSQL Redis 数据库
Redis AOF重写问题之同一数据产生两次磁盘IO如何解决
Redis AOF重写问题之同一数据产生两次磁盘IO如何解决
Redis AOF重写问题之同一数据产生两次磁盘IO如何解决
|
6月前
|
关系型数据库 MySQL OLTP
性能工具之 MySQL OLTP Sysbench BenchMark 测试示例
【8月更文挑战第6天】使用 pt-query-digest 工具分析 MySQL 慢日志性能工具之 MySQL OLTP Sysbench BenchMark 测试示例
398 0
性能工具之 MySQL OLTP Sysbench BenchMark 测试示例
|
5月前
crash —— 获取系统的磁盘IO统计数据
crash —— 获取系统的磁盘IO统计数据
|
9月前
|
存储 消息中间件 缓存
jeecgboot运行磁盘不足问题( java.io.IOException)和redis闪退问题
jeecgboot运行磁盘不足问题( java.io.IOException)和redis闪退问题
98 0
|
6月前
|
存储 Java
【IO面试题 四】、介绍一下Java的序列化与反序列化
Java的序列化与反序列化允许对象通过实现Serializable接口转换成字节序列并存储或传输,之后可以通过ObjectInputStream和ObjectOutputStream的方法将这些字节序列恢复成对象。
|
7月前
|
Java 大数据
解析Java中的NIO与传统IO的区别与应用
解析Java中的NIO与传统IO的区别与应用

热门文章

最新文章

  • 1
    小鱼深度评测 | 通义灵码2.0,不仅可跨语言编码,自动生成单元测试,更炸裂的是集成DeepSeek模型且免费使用,太炸裂了。
  • 2
    3天功能开发→3小时:通义灵码2.0+DEEPSEEK实测报告,单元测试生成准确率92%的秘密
  • 3
    Potpie.ai:比Copilot更狠!这个AI直接接管项目代码,自动Debug+测试+开发全搞定
  • 4
    基于FPGA的图像双线性插值算法verilog实现,包括tb测试文件和MATLAB辅助验证
  • 5
    【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
  • 6
    大前端之前端开发接口测试工具postman的使用方法-简单get接口请求测试的使用方法-简单教学一看就会-以实际例子来说明-优雅草卓伊凡
  • 7
    「ximagine」业余爱好者的非专业显示器测试流程规范,同时也是本账号输出内容的数据来源!如何测试显示器?荒岛整理总结出多种测试方法和注意事项,以及粗浅的原理解析!
  • 8
    用户说 | 通义灵码2.0,跨语言编码+自动生成单元测试+集成DeepSeek模型且免费使用
  • 9
    以项目登录接口为例-大前端之开发postman请求接口带token的请求测试-前端开发必学之一-如果要学会联调接口而不是纯写静态前端页面-这个是必学-本文以优雅草蜻蜓Q系统API为实践来演示我们如何带token请求接口-优雅草卓伊凡
  • 10
    AxBench:斯坦福大学推出评估语言模型控制方法的基准测试框架