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
原文地址:https://blog.51cto.com/yangzhiming/2436402
时间: 2024-11-14 14:41:10