sysbench利用fabric磁盘IO测试

利用sysbench测试磁盘IO:

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

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

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

测试执行:

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

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

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

脚本如下:

vim fabfile.py

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 = ‘[email protected]‘
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。

时间: 2024-07-29 23:54:12

sysbench利用fabric磁盘IO测试的相关文章

sysbench对MySQL的压测,使用sysbench压测磁盘io

QPS - query per secondTPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的 Ⅰ.sysbench测试框架 Ⅱ.常用测试脚本 [[email protected]_42_63_centos lua]# pwd /usr/local/src/sysbench-master/src/lua [[email protected]_42_63_centos lua]# ll *.lua -rwxr-xr-x 1 root root

关于/dev/null 和 /dev/zero文件详解以及误删/dev/null和/dev/zero的解决方法和利用/dev/zero进行磁盘IO测试方法

1.概论 -- 来自维基的解释 /dev/null  : 在类Unix系统中,/dev/null,或称空设备,是一个特殊的设备文件,它丢弃一切写入其中的数据(但报告写入操作成功),读取它则会立即得到一个EOF.在程序员行话,尤其是Unix行话中,/dev/null 被称为位桶(bit bucket)或者黑洞(black hole).空设备通常被用于丢弃不需要的输出流,或作为用于输入流的空文件.这些操作通常由重定向完成. /dev/zero  : 在类UNIX 操作系统中, /dev/zero 是

sysbench 对 mysql-5.6.28 测试

1.下载sysbench-0.5.tar.gz sysbench源代码可以在https://launchpad.net/sysbench找到 该目录将在后续sysbench安装中,多次使用.如果MySQL不是安装在该默认目录,请在后续步骤中替换. 首先RPM方式安装mysql-5.6.28 sysbench需要autoconf.automake及libtool包,如果这些包不存在,需要先安装. yum -y install libtool  automake autoconf 执行如下命令,安装

IO测试工具 - 用于IO测试 ; linux benchmarks

IO测试工具,用于磁盘IO测试,下面进行使用列表进行记录: iozone fio dd ioping iotop iostat bonnie++ crystalDisk Atto as-ssd-benchmark hdtune 文件系统测试工具:https://www.cnblogs.com/xuyaowen/p/filesystem-test-suites.html bench工具:https://github.com/haydenjames/bench-scripts 可用于磁盘IO测试和文

用systemtap对sysbench IO测试结果的分析1

http://www.actionsky.com/docs/archives/171 2016年5月6日  黄炎 近期在一些简单的sysbench IO测试中, 遇到了一些不合常识的测试结果. 从结果看, 虽然不是有实际意义的测试结果, 但探索过程中, 利用到了Systemtap进行观测(动态追踪), 可在其他分析中借用. 目录 1 测试环境准备 2 现象1 2.1 步骤1 2.2 结果1 2.3 分析1 2.4 插曲1 2.4.1 观测工具使用不当带来测试偏差 2.4.2 使用另一观测工具用于

SQLIO 模拟随机或者顺序的方式来测试磁盘IO的性能

SQLIO 功能:磁盘IO压力测试工具,SQLIO主要是模拟随机或者顺序的方式来测试磁盘IO的性能. SQLIO Disk Subsystem Benchmark Tool工具下载地址: http://www.microsoft.com/en-us/download/details.aspx?id=20163 RAID存储技术在SQL Server服务器上已经被广泛使用,对于存储介质,有很多层面的硬件和固件,以及存储管理软件配置.如果设置不恰当,同样的硬件最后的效能会差别很大. 微软提供了一个工

磁盘io系统压力测试工具fio

FIO概述 fio是一个基于GPLV2授权的开源压力测试工具,主要是用来测试磁盘io性能,也有cpu,nic的io测试功能. 1.安装FIO yum -y install wget yum -y install libaio-devel wget http://brick.kernel.dk/snaps/fio-2.1.tar.gz tar zxvf fio-2.1.tar.gz cd fio-2.1 make make install 2.fio测试命令参数 filename=/dev/sda

记一次性能测试:mysql占用磁盘IO过高 的解决过程

在一次性能测试时,发现mysql的cpu使用率不高,但是磁盘io很高, 一开始考虑是mysql的慢日志比较多,但是查看后发现慢日志并不多,而且只有一台mysql. 进入实例,查看sync_binlog变量 mysql> show variables like '%sync_binlog%' -> ; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | sync_binlog | 1 |

Mysql多线程性能测试工具sysbench 安装、使用和测试

From:http://www.cnblogs.com/zhoujinyi/archive/2013/04/19/3029134.html 摘要:      sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL.Oracle和PostgreSQL.当前功能允许测试的系统参数有: file I/O performance (文件I / O性能) scheduler performance (调