**
TiDB性能测试
**
建议使用 Sysbench 1.0 或之后的更新版本
软件下载地址
https://github.com/akopytov/sysbench
https://github.com/akopytov/sysbench/archive/1.0.20.tar.gz
安装依赖包
yum -y install gcc gcc-c++ automake make libtool pkgconfig libaio-devel openssl-devel
上传服务器并解压并编译安装sysbench,依次执行如下命令:
tar -zxvf 1.0.16.tar.gz
cd sysbench-1.0.16
./autogen.sh
./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql --with-mysql
make -j 2 && make install
踩坑一:
执行./configure --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/bin/ 时报错:
cannot find MySQL client libraries
解决方案:缺少mysql-devel这个库,执行:yum install mysql-devel
安装完成后再次执行…/configure --with-mysql-includes=/usr/local/mysql/include/ ,成功
准备配置文件:tidb-config
mysql-host=10.168.2.xx
mysql-port=4000
mysql-user=root
mysql-password=xxxxxx
mysql-db=test
db-driver=mysql
sysbench安装目录,里面包含了很多脚本:/usr/local/share/sysbench
测试执行
导入数据:
sysbench --config-file=tidb-config oltp_point_select --tables=32 --table-size=10000000 prepare
测试数据准备(实际是创建的表):
sysbench /usr/local/share/sysbench/bulk_insert.lua --config-file=tidb-config --tables=50 --threads=100 --table_size=20000000 --report-interval=10 prepare
批量插入数据(是插入表的数据):
sysbench /usr/local/share/sysbench/oltp_insert.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=2000000 --report-interval=10 run
更新数据:
sysbench /usr/local/share/sysbench/bulk_insert.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=30000000 --report-interval=10 run
查询数据:
sysbench /usr/local/share/sysbench/oltp_read_only.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=30000000 --report-interval=10 run
版权归原作者 全能测试小王子 所有, 如有侵权,请联系我们删除。