First, get the installation package
The most recent version is 0.4.12, download Address: http://sourceforge.net/projects/sysbench/
Ii. Compiling and installing
My environment for RHEL6.2 + MySQL 5.6.16, build reference on the two articles <<rhel6.2 compile install MySQL 5.6.16>><<mysql Benchmark install DBI component >>, The installation steps are as follows:
Copy Code code as follows:
[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
Because my MySQL is compiled and installed, the above need to give the MySQL library file location (corresponding to the-with-mysql-includes and –with-mysql-libs options).
Common errors during installation are as follows:
Copy Code code as follows:
.. /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'll require--mode=mode is 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
In previous versions, we only needed to execute the autogen.sh script in the Sysbench extract directory before compiling the operation, but now we're going to make the same mistake because Sysbench has a problem with libtool, and we can compare it to/usr/ The difference between the Bin/libtool file is that it can be resolved by replacing the Libtool file, or by modifying the following contents of the Aclocal.m4 file
Copy Code code as follows:
# Always Use our own libtool.
Libtool= ' $ (SHELL) $ (top_builddir)/libtool '
Ac_subst (LIBTOOL) DNL
Modify the value of the Libtool variable to: ' $ (SHELL)/usr/bin/libtool ', even with the system's Libtool toolkit.
The modifications are performed before the make && make install can be successfully installed.
Install complete immediately test:
Copy Code code as follows:
[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 dire Ctory
Said is missing libmysqlclient.so.18 file, the amount, this file is present, need to manually link:
Copy Code code as follows:
[ROOT@BEANVM ~]# ls-l/usr/local/mysql/lib/libmysqlclient.so.18*
lrwxrwxrwx. 1 MySQL Feb 14:39/usr/local/mysql/lib/libmysqlclient.so.18-> libmysqlclient.so.18.1.0
-rwxr-xr-x. 1 mysql mysql 7654927 Feb 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/
Deployment complete, run a CPU benchmark test:
Copy Code code as follows:
[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. Percentile:5.20ms
Threads Fairness:
Events (Avg/stddev): 10000.0000/0.00
Execution Time (Avg/stddev): 40.4165/0.00