sysbench测试mysql性能

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sysbench测试mysql性能相关的知识,希望对你有一定的参考价值。

sysbench测试mysql性能:

安装 sysbench 0.5:

apt-get install bzr automake libtool libmysqlclient-dev

ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.14 /usr/lib/libmysqlclient_r.so

bzr branch lp:sysbench

cd sysbench/

./autogen.sh

./configure

make && make install

file I/O performance (文件I/O性能)
scheduler performance (调度性能)
memory allocation and transfer speed (内存分配和传输速度)
POSIX threads implementation performance (POSIX线程执行绩效)
database server performance (OLTP benchmark)(数据库服务器性能)

测试CPU:

/usr/local/bin/sysbench --test=cpu --cpu-max-prime=2000 --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx run

测试线程:

/usr/local/bin/sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-lock=4 --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx run

测试IO:

准备:

/usr/local/bin/sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx prepare

测试:

/usr/local/bin/sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx run

清理:

/usr/local/bin/sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx cleanup

测试内存:

/usr/local/bin/sysbench --test=memory --memory-block-size=8k --memory-total-size=1G --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx run

测试mutex(互斥性能测试):

/usr/local/bin/sysbench --test=mutex --num-threads=100 --mutex-num=100 --mutex-locks=100000 --mutex-loops=10000 --mysql-host=10.0.1.5 --mysql-db=ming --mysql-user=ming --mysql-password=xxxxx run

测试OLTP(数据库服务器性能):

准备:

/usr/local/bin/sysbench --test=./sysbench/sysbench/tests/db/oltp.lua --mysql-table-engine=innodb --mysql-host=10.0.1.5 --mysql-db=ming --oltp-table-size=500000 --mysql-user=ming --mysql-password=xxxxx prepare

测试:

/usr/local/bin/sysbench --num-threads=10 --test=./sysbench/sysbench/tests/db/oltp.lua --mysql-table-engine=innodb --mysql-host=10.0.1.5 --mysql-db=ming --oltp-table-size=500000 --mysql-user=ming --mysql-password=xxxx run

清理:

/usr/local/bin/sysbench --test=./sysbench/sysbench/tests/db/oltp.lua --mysql-table-engine=innodb --mysql-host=10.0.1.5 --mysql-db=ming --oltp-table-size=500000 --mysql-user=ming --mysql-password=xxxx cleanup

以上是关于sysbench测试mysql性能的主要内容,如果未能解决你的问题,请参考以下文章

Mysql 性能测试工具 sysbench的安装和使用

sysbench使用与mysql性能测试

使用sysbench对mysql压力测试

MySQL性能测试工具sysbench的安装和使用

sysbench mysql-ssd与hdd性能测试

sysbench性能压测以及mysql性能压测