sysbench (System performance benchmark)
是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况。
它主要包括以下几种方式的测试:
1. cpu 中央处理器
2. threads POSIX线程性能
3. mutex 互斥
4. memory 内存分配及传输速度
5. fileio 文件IO性能
6. oltp 数据库性能(OLTP基准测试)
目前sysbench主要支持 MySQL,pgsql,oracle 这3种数据库。
安装
在
http://sourceforge.net/
查找sysbench 下载最新源码包。
CentOS release 5.4 (Final) 下 sysbench-0.4.8.tar.gz和 sysbench-0.4.10.tar.gz测试安装成功
编译安装
默认支持MySQL,如果需要测试Oracle/PostgreSQL,则在configure时需要加上--with-oracle或者--with-pgsql参数
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include/mysql/ --with-mysql-libs=/usr/local/mysql/lib/mysql/
make && make install
|
说明:
--with-mysql-includes指定函数库位置
--with-mysql-libs指定头文件位置
公共选项
NinGoo:/u01/sysbench/bin>$sysbench
Missing required command argument.
Usage:
sysbench [general-options]... --test= [test-options]... command
General options:
--num-threads=N number of threads to use [1]
--max-requests=N limit for total number of requests [10000]
--max-time=N limit for total execution time in seconds [0]
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]
--thread-stack-size=SIZE size of stack per thread [32K]
--init-rng=[on|off] initialize random number generator [off]
--test=STRING test to run
--debug=[on|off] print more debugging info [off]
--validate=[on|off] perform validation checks where possible [off]
--help=[on|off] print help and exit
--version=[on|off] print version and exit
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
Commands: prepare run cleanup help version
See 'sysbench --test= help' for a list of options for each test
|
CPU测试
sysbench采用寻找最大素数的方式来测试CPU的性能,测试例子:
sysbench --test=cpu --cpu-max-prime=20000 run
线程测试
线程测试私有选项:
threads options:
--thread-yields=N number of yields to do per request [1000]
--thread-locks=N number of locks per thread [8]
测试例子:sysbench --num-threads=64 --test=threads --thread-yields=100 --thread-locks=2 run
互斥测试
互斥测试私有选项:
--mutex-num=N total size of mutex array [4096]
--mutex-locks=N number of mutex locks to do per thread [50000]
--mutex-loops=N number of empty loops to do inside mutex lock [10000]
测试例子:sysbench --test=mutex run
内存测试
内存测试私有选项:
--memory-block-size=SIZE size of memory block for test [1K]
--memory-total-size=SIZE total size of data to transfer [100G]
--memory-scope=STRING memory access scope {global,local} [global]
--memory-hugetlb=[on|off] allocate memory from HugeTLB pool [off]
--memory-oper=STRING type of memory operations {read, write, none} [write]
--memory-access-mode=STRING memory access mode {seq,rnd} [seq]
测试例子:sysbench --test=memory --num-threads=16 --memory-block-size=8192 --memory-total-size=8G run
文件IO性能测试
文件IO测试私有选项:
fileio options:
--file-num=N number of files to create [128]
--file-block-size=N block size to use in all IO operations [16384]
--file-total-size=SIZE total size of files to create [2G]
--file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
--file-io-mode=STRING file operations mode {sync,async,fastmmap,slowmmap} [sync]
--file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []
--file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
--file-fsync-all=[on|off] do fsync() after each write operation [off]
--file-fsync-end=[on|off] do fsync() at the end of test [on]
--file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
--file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]
--file-rw-ratio=N reads/writes ratio for combined test [1.5]
I/O操作的支持:
seqwr 顺序写
seqrewr 连续改写
seqrd 连续读
rndrd 随机读取
rndwr 随机写
rndrw 结合随机读/写
测试例子:
Usage example:
sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw prepare
说明:起草文件总大小为3G 16个并发线程 随机读写模式,会在当前目录下生成一堆小文件。
sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw run
说明:执行测试。
sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw cleanup
清理测试产生的所有东西。
MySQL测试:
查看数据库测试私有选项,每种数据库都不不一样,查看具体选项:
sysbench --test=oltp help
使用方法基本与IO测试相同,官方测试范例:
1 、准备数据
sysbench --debug=off --test=oltp --mysql-host=192.168.1.126 --mysql-user=root --mysql-password='password' --oltp-table-size=1000000 --mysql-db=sbtest --oltp-table-name=sbtest --num-threads=20 --max-requests=10000 --oltp-auto-inc=off --mysql-engine-trx=yes prepare
2、测试
sysbench --debug=off --test=oltp --mysql-host=192.168.1.126 --mysql-user=root --mysql-password='password' --oltp-table-size=1000000 --mysql-db=sbtest --oltp-table-name=sbtest --num-threads=20 --max-requests=10000 --oltp-auto-inc=off --mysql-engine-trx=yes run
3、删除数据
sysbench --debug=off --test=oltp --mysql-host=192.168.1.126 --mysql-user=root --mysql-password='password' --oltp-table-size=1000000 --mysql-db=sbtest --oltp-table-name=sbtest --num-threads=20 --max-requests=10000 --oltp-auto-inc=off --mysql-engine-trx=yes cleanup
分享到:
相关推荐
数据库经典压测工具sysbench双版本 sysbench0.5支持oracle sysbench1.1 支持达梦 附详细安装文档,亲测可用
sysbench 基准测试结果数据,分为50线程,100线程,200线程。
https://github.com/akopytov/sysbench 下载的sysbench源码
sysbench是一个模块化、跨平台、多线程基准测试工具,主要用于测试不同系统参数下的数据库负载情况,本文主要介绍0.4版本的使用。sysbench主要用于以下性能测试: 文件I/O性能 调度 内存分配和传输 POSIX线程 ...
sysbench(sysbench-1.0.20)是一个基于LuaJIT的可编写脚本的多线程基准测试工具,主要用于数据库基准测试。 sysbench-1.0.20.tar.gz sysbench-1.0.20.zip
sysbench 分析mysql画图
sysbench-1.0.18的下载安装和测试脚本
mysql性能测试工具:sysbench+资源(autoconf、automake、libtool)
mysql的sysbench基准测试,包括sysbench下载链接,安装及测试
sysbench数据库压力测试工具 也可以多io 内存 cpu等进行测试
sysbench基准测试并数据统计--TPS、QPS、TPMC及响应时间,让你第一时间了解数据库的运行情况。
mysql官方基准测试工具,内含linux6.x版本和linux7.x版本的安装tar包,另附详细的安装说明和sysbench的使用说明,包括详尽的测试参数说明和性能测试方式说明,sysbench版本为1.0.8
sysbench-1.0.19.zip 源码,压力测试数据。我下载的目的在于想压力测试mysql。
sysbench进行cpu,磁盘IO,内存,OLTP基准测试, 一sysbench-05安装 二用法下面的测试案例需要用到这些说明才能看的懂的 三开始测试 cpu性能测试 线程测试 磁盘IO性能测试 内存测试 OLTP测试
MySQL 性能测试工具sysbench安装使用
Sysbench压测工具搭建和使用实践,MySQL DBA经常用的
数据库目前支持MySQL/Oracle/PostgreSQL。本文只是简单演示一下几种测试的用法,后续准备利用sysbench来对MySQL进行一系列的测试。具体的一些参数设置,需要根据不同的测试要求来进行调整。
sysbench 0.4.10版本,源码,安装包
本文详细描述了sysbench的安装与简单使用,并模拟测试步骤