sysbench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况.
主要包括以下几种方式的测试:
1、cpu性能
2、磁盘io性能
3、调度程序性能
4、内存分配及传输速度
5、POSIX线程性能
6、数据库性能(OLTP基准测试)
一、安装:
依赖包:
yum install gcc* glibc* libtool* automake* zlib* -y --skip-broken
yum install bzr* -y
tar -zxvf sysbench-0.5.tar.gz -C /mnt
cd /mnt/sysbench-0.5
chmod +x autogen.sh
[root@localhost sysbench-0.5]# ./autogen.sh
报错了:
libtoolize 1.4+ wasn't found, exiting
安装依赖包::yum install libtool
#./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql-5.6.25-linux-glibc2.5-x86_64/include --with-mysql-libs=/usr/local/mysql-5.6.25-linux-glibc2.5-x86_64/lib
# make && make install
#cp /usr/local/sysbench/bin/sysbench /usr/bin/
##sysbench --help
若报错:
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory问题原因:sysbench无法找到mysql的库文件,可能是环境变量LD_LIBRARY_PATH没有设置,设置后即可解决该问题: 添加export LD_LIBRARY_PATH=/usr/local/mysql-5.6.25-linux-glibc2.5-x86_64/lib即可
###其他测试略
###MySQL测试:--
sysbench --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp-read-only=off --init-rng=on --num-threads=100 --max-requests=200000 --oltp-dist-type=uniform --max-time=1800 --mysql-user=superdata --oltp-table-size=2000000 --oltp_tables_count=10 --rand-init=on --mysql-password='root123' --mysql-port=3306 --mysql-host='192.168.15.57' --db-driver=mysql --mysql-user=dlan --mysql-db=test --mysql-table-engine=innodb prepare sysbench --test=/usr/local/sysbench/sysbench/tests/oltp.lua --oltp-read-only=off --init-rng=on --num-threads=100 --max-requests=200000 --oltp-dist-type=uniform --max-time=1800 --mysql-user=dlan --oltp-table-size=2000000 --oltp_tables_count=10 --rand-init=on --mysql-password='root123' --mysql-port=3306 --mysql-host='192.168.15.57' --db-driver=mysql --mysql-db=test run ###参数详解 prepare 生成表并插入数据,可使用parallel_prepare.lua脚本来并行准备数据。 –db-driver 服务器类型 mysql | drizzle,默认为mysql –mysql-table-engine 表存数引擎 –myisam-max-rows MyISAM表MAX_ROWS选项(用于大表) –oltp-table-count 生成表数量[sbtest1、sbtest2...] –oltp-table-size 生成表的行数 –oltp-secondary ID列生成二级索引而不是主键 –oltp-auto-inc 设置ID列是否自增 on | off,默认为on