您的位置:首页 > 博客中心 > 数据库 >

MySQL性能测试之sysbench和TPCC的安装配置和使用

时间:2022-03-15 04:51

sysbench

1)下载sysbench
git clone https://github.com/akopytov/sysbench.git
2)编译&安装
./autogen.sh
./configure --prefix=/home/ddb/tmp/sysbench
make && make install
3)./sysbench --help
4)初始化数据
sysbench --test=parallel_prepare.lua --oltp_tables_count=1 --rand-init=on --oltp-table-size=500000000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-requests=0 prepare
5)运行测试
sysbench --test=oltp.lua --oltp_tables_count=1 --num-threads=100 --oltp-table-size=500000000 --oltp-read-only=off --report-interval=10 --rand-type=uniform --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-time=1000 --max-requests=0 run
6)数据清理
sysbench --test=parallel_prepare.lua --oltp_tables_count=1 --rand-init=on --oltp-table-size=500000000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-requests=0 cleanup

TPCC

1)下载Tpcc-mysql

bzr branch lp:~percona-dev/perconatools/tpcc-mysql
2)编译安装
cd src
make
export LD_LIBRARY_PATH=$MYSQL_HOME/lib
export C_INCLUDE_PATH=$MYSQL_HOME/include
export PATH=$MYSQL_HOME/bin:$PATH
3)创建表结构和索引
mysql>create database tpcc;
mysql>source create_table.sql
mysql>source add_fkey_idx.sql
4)导数据
./tpcc_load [server] [DB] [user] [pass] [warehouse_num]
5)运行测试
./tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouse -c connections -r warmup_time -I running_time -i report-interval -f report-file

本类排行

今日推荐

热门手游