sysbench安装及简单使用


1、https://github.com/akopytov/sysbench#rhelcentos获取

或是

wget https://github.com/akopytov/sysbench/archive/master.zip

2、解压

unzip master.zip

3、编译安装

确保已经安装了相关的依赖

yum -y install  make automake libtool pkgconfig libaio-devel vim-common

 

./autogen.sh
./configure
make -j
make install

4、测试是否成功安装

sysbench --version

 

安装完成会自带几个lua脚本文件,路径在/usr/local/share/sysbench 或 /usr/share/sysbench/tests/include/oltp_legacy下

 

 

压测模型 描述
bulk_inert.lua 批量插入数据
insert.lua 单值插入数据
delete.lua 删除数据
oltp.lua 混合读写测试,读写比例14:4
select.lua 简单的主键查询

 

1、数据准备

sysbench /usr/local/share/sysbench/oltp_write_only.lua --table-size=1000000 --tables=10 --threads=32 --db-driver=mysql --mysql-db=sysbench --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=root prepare

2、进行测试write_only,并将测试结果导出到文件中,便于后续分析。

sysbench /usr/local/share/sysbench/oltp_write_only.lua --table-size=1000000 --tables=10 --threads=32 --db-driver=mysql --mysql-db=sysbench --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=root run > test.log

3、清除数据

sysbench /usr/local/share/sysbench/oltp_write_only.lua --table-size=1000000 --tables=10 --threads=32 --db-driver=mysql --mysql-db=sysbench --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=root cleanup

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM