sysbench-0.4.12編譯安裝和CPU測試例子分享
一、獲取安裝包
最近的版本為0.4.12,下載地址:http://sourceforge.net/projects/sysbench/
二、編譯安裝
我的環(huán)境為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的庫文件位置(對應(yīng)—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
在之前版本中,碰見這個問題我們只需要在編譯操作前執(zhí)行sysbench解壓目錄下的autogen.sh腳本即可;不過現(xiàn)在這樣做還是會報同樣的錯誤,原因是sysbench自帶的libtool有問題,我們可以比較它和/usr/bin/libtool文件的區(qū)別得知,總之可以通過替換這個libtool文件來解決,或者修改aclocal.m4文件的如下內(nèi)容
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
將LIBTOOL變量的值修改為:'$(SHELL) /usr/bin/libtool',即使用系統(tǒng)的libtool工具包。
修改后再執(zhí)行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
相關(guān)文章
Ubuntu Server下MySql數(shù)據(jù)庫備份腳本代碼
為了mysql數(shù)據(jù)庫的安全,我們需要定時備份mysql數(shù)據(jù)庫,這里提供下腳本代碼,需要的朋友可以參考下2013-06-06mysql?ON?DUPLICATE?KEY?UPDATE重復插入時更新方式
這篇文章主要介紹了mysql?ON?DUPLICATE?KEY?UPDATE重復插入時更新方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-07-07