服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|数据库技术|

服务器之家 - 数据库 - Mysql - sysbench-0.4.12编译安装和CPU测试例子分享

sysbench-0.4.12编译安装和CPU测试例子分享

2020-04-12 15:04MYSQL教程网 Mysql

这篇文章主要介绍了sysbench-0.4.12编译安装和CPU测试例子分享,本文还包含安装过程中的错误及解决方法,使用时的错误和解决方法,需要的朋友可以参考下

一、获取安装包

最近的版本为0.4.12,下载地址:http://sourceforge.net/projects/sysbench/

二、编译安装

我的环境为RHEL6.2 + MySQL 5.6.16,搭建参考上两篇文章<<RHEL6.2编译安装MySQL 5.6.16>><<MySQL Benchmark安装DBI组件>>,安装步骤如下:

复制代码 代码如下:

[root@beanvm ~]# tar -xvf sysbench-0.4.12.tar.gz
[root@beanvm ~]# cd sysbench-0.4.12
[root@beanvm sysbench-0.4.12]# ./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib && make && make install

 

因为我的MySQL是编译安装的,所以上面需要给出MySQL的库文件位置(对应—with—mysql-includes和–with-mysql-libs选项)。

安装过程中常见的报错如下:

复制代码 代码如下:

../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/lib: No such file or directory
../libtool: line 2403: Xsysbench: command not found

 

在之前版本中,碰见这个问题我们只需要在编译操作前执行sysbench解压目录下的autogen.sh脚本即可;不过现在这样做还是会报同样的错误,原因是sysbench自带的libtool有问题,我们可以比较它和/usr/bin/libtool文件的区别得知,总之可以通过替换这个libtool文件来解决,或者修改aclocal.m4文件的如下内容

复制代码 代码如下:

# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl

 

将LIBTOOL变量的值修改为:'$(SHELL)  /usr/bin/libtool',即使用系统的libtool工具包。

修改后再执行make && make install即可顺利安装。

安装完成马上测试一下:

复制代码 代码如下:

[root@beanvm sysbench-0.4.12]# sysbench
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

 

说是缺少libmysqlclient.so.18文件,额,这个文件是存在的,需要手动链接一下:

 

复制代码 代码如下:

[root@beanvm ~]# ls -l /usr/local/mysql/lib/libmysqlclient.so.18*
lrwxrwxrwx. 1 mysql mysql      24 Feb 15 14:39 /usr/local/mysql/lib/libmysqlclient.so.18 -> libmysqlclient.so.18.1.0
-rwxr-xr-x. 1 mysql mysql 7654927 Feb 15 14:30 /usr/local/mysql/lib/libmysqlclient.so.18.1.0
[root@beanvm ~]# ls -l /usr/lib/libmysqlclient.so.18*
ls: cannot access /usr/lib/libmysqlclient.so.18*: No such file or directory
[root@beanvm ~]# ln ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/

 

部署完成,运行一个CPU基准测试:

 

复制代码 代码如下:


[root@beanvm ~]# sysbench --test=cpu --cpu-max-prime=20000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

 

Running the test with following options:
Number of threads: 1

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000

Test execution summary:
    total time:                          40.4541s
    total number of events:              10000
    total time taken by event execution: 40.4165
    per-request statistics:
         min:                                  3.64ms
         avg:                                  4.04ms
         max:                                 21.82ms
         approx.  95 percentile:               5.20ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   40.4165/0.00

 

延伸 · 阅读

精彩推荐