systench-0.5安装测试:
tar zxvf sysbench-0.5.tar.gz
chmod +x autogen.sh
./autogen.sh
./configure --with-mysql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make
make install
yum install m4 autoconf automake libtool
./autogen.sh
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/opt/mysql3306/include --with-mysql-libs=/opt/mysql3306/lib
make && make install
或:
rpm -ivh Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
rpm -ivh sysbench-0.5-3.el6_.x86_64.rpm
检查sysbench是否正确安装:
sysbench -v
运行时常见问题:
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
which sysbench
export LD_LIBRARY_PATH=/usr/local/mysql/lib
create database sbtest;
lua脚本目录:
/soft/sysbench-0.5/sysbench/tests/db/oltp.lua
准备数据阶段:
sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=test --oltp-tables-count=10 --oltp-table-size=60000 --num-threads=50 --max-requests=100000000 --report-interval=1 --test=/soft/sysbench-0.5/sysbench/tests/db/oltp.lua prepare
运行阶段:
oltp进行压测
sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=test --oltp-tables-count=10 --oltp-table-size=60000 --num-threads=50 --max-requests=100000000 --report-interval=1 --max-time=20 --test=/soft/sysbench-0.5/sysbench/tests/db/oltp.lua run
清理阶段:
sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=test --oltp-tables-count=10 --oltp-table-size=60000 --num-threads=50 --max-requests=100000000 --report-interval=1 --max-time=20 --test=/soft/sysbench-0.5/sysbench/tests/db/oltp.lua cleanup
纯insert情况
sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=test --oltp-tables-count=10 --oltp-table-size=6000000 --num-threads=50 --max-requests=100000000 --report-interval=1 --max-time=20 --test=/soft/sysbench-0.5/sysbench/tests/db/insert.lua run
内存测试
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
sysbench --test=memory --memory-block-size=8192 --memory-total-size=4G run
磁盘IO测试
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw run
测试结果:
查看关键点
transactions: 5724841 (954.14 per sec.) (代表TPS)
read/write requests: 103047138 (17174.45 per sec.) (代表QPS)
时间统计信息(最小,平均,最大响应时间,以及95%百分比响应时间)
response time:
min: 2.11ms
avg: 16.77ms
max: 75652.05ms
approx. 99 percentile: 74.13ms
测试脚本:
http://bazaar.launchpad.net/~ahel/maria/mariadb-benchmarks/revision/20
循环测试脚本:
#!/bin/bash
i=1
while true
do
while [ $i -le 1000 ]
do
/usr/local/bin/sysbench --test=oltp --mysql-table-engine=innodb
--oltp-table-size=10000 --max-requests=100 --num-threads=6 --
mysql-host=192.168.110.140 --mysql-port=3306 --mysql-user=admin
--mysql-password=123456 --mysql-db=test --mysql-socket=/tmp/
mysql.sock run >> semi_replication.txt
let i++
done
break
done
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/91975/viewspace-1743534/
,如需转载,请注明出处,否则将追究法律责任。