sysbench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况,主要测试以下几种:(1).cpu性能(2).磁盘io性能(3).
sysbench是一个模块化的、跨平台、多线程基准测试工具,,主要用于评估测试各种不同系统参数 下的数据库负载情况,主要测试以下几种:
(1).cpu性能
(2).磁盘io性能
(3).调度程序性能
(4).内存分配及传输速度
(5).posix线程性能
(6).数据库性能(oltp基准测试)
1.下载和安装sysbench工具
[root@centos179min home]# wget
[root@centos179min home]# cd sysbench-0.4.10
[root@centos179min sysbench-0.4.10]# ./configure --help | grep mysql --自己仔细查看安装帮助
--with-mysql compile with mysql support (default is enabled)
--with-mysql-includes path to mysql header files
--with-mysql-libs path to mysql libraries
report bugs to alexeyk@mysql.com.
[root@centos179min sysbench-0.4.10]# ./configure --prefix=/usr/local/sysbench-0.4.10 --with-mysql --with-mysql-includes=/usr/local/mysql-5.7.4-m14-linux/include/ --with-mysql-libs=/usr/local/mysql-5.7.4-m14-linux/lib/
[root@centos179min sysbench-0.4.10]# make --这时如果以下错误
drv_mysql.c: in function 'mysql_drv_store_results':
drv_mysql.c:784: error: 'mysql' undeclared (first use in this function)
drv_mysql.c:784: error: 'con' undeclared (first use in this function)
drv_mysql.c:785: error: 'mysql_res' undeclared (first use in this function)
drv_mysql.c:785: error: 'res' undeclared (first use in this function)
drv_mysql.c:786: error: 'mysql_row' undeclared (first use in this function)
drv_mysql.c:786: error: expected ';' before 'row'
drv_mysql.c:834: error: 'er_lock_deadlock' undeclared (first use in this function)
drv_mysql.c:834: error: 'er_lock_wait_timeout' undeclared (first use in this function)
drv_mysql.c:850: error: 'row' undeclared (first use in this function)
drv_mysql.c: in function 'mysql_drv_free_results':
drv_mysql.c:874: error: 'mysql_res' undeclared (first use in this function)
drv_mysql.c:874: error: expected expression before ')' token
make[3]: *** [libsbmysql_a-drv_mysql.o] error 1
make[3]: leaving directory `/home/sysbench-0.4.10/sysbench/drivers/mysql'
make[2]: *** [all-recursive] error 1
make[2]: leaving directory `/home/sysbench-0.4.10/sysbench/drivers'
make[1]: *** [all-recursive] error 1
make[1]: leaving directory `/home/sysbench-0.4.10/sysbench'
make: *** [all-recursive] error 1
[root@centos179min sysbench-0.4.10]# yum install mysql-devel --解决方法,安装mysql-devel开发包
[root@centos179min sysbench-0.4.10]# rpm -ql mysql-devel | grep include --查看开发包的路径
[root@centos179min sysbench-0.4.10]# ./configure --prefix=/usr/local/sysbench-0.4.10 --with-mysql --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/local/mysql-5.7.4-m14-linux/lib/mysql
[root@centos179min sysbench-0.4.10]# make --这时如果再有以下错误
../libtool: line 841: x--tag=cc: command not found
../libtool: line 874: libtool: ignoring unknown tag : command not found
../libtool: line 841: x--mode=link: command not found
../libtool: line 1007: *** warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1008: *** future versions of libtool will require --mode=mode be specified.: command not found
../libtool: line 2234: x-g: command not found
../libtool: line 2234: x-o2: command not found
../libtool: line 1954: x-l/usr/local/mysql-5.7.4-m14-linux/lib/mysql: no such file or directory
../libtool: line 2403: xsysbench: command not found
../libtool: line 2408: x: command not found
../libtool: line 2415: xsysbench: command not found
../libtool: line 2550: x-lmysqlclient_r: command not found
../libtool: line 2550: x-lrt: command not found
../libtool: line 2550: x-lm: command not found
../libtool: line 2632: x-l/home/sysbench-0.4.10/sysbench: no such file or directory
../libtool: line 2550: x-lmysqlclient_r: command not found
../libtool: line 2550: x-lrt: command not found
../libtool: line 2550: x-lm: command not found
../libtool: line 2632: x-l/home/sysbench-0.4.10/sysbench: no such file or directory
[root@centos179min sysbench-0.4.10]# vim libtool --解决方法(将libtool文件中的echo=改为echo=)
echo=echo 修改为 echo=echo
[root@centos179min sysbench-0.4.10]# make --此时不会再有错误了
[root@centos179min sysbench-0.4.10]# make install
[root@centos179min sysbench-0.4.10]# echo $? --检查是否安装成功
0
[root@centos179min sysbench-0.4.10]# ll /usr/local/sysbench-0.4.10/bin/
total 288
-rwxr-xr-x. 1 root root 293649 oct 8 20:00 sysbench
[root@centos179min sysbench-0.4.10]#
2.测试cpu的性能