基准测试工具Sysbench

安装:
下载 http://sysbench.sourceforge.net/

1 tar zxvf sysbench-0.4.12.tar.gz
2 cd sysbench-0.4.12
3 ./autogen.sh  (问题一)
4 ./configure --prefix=/usr/local/webserver/sysbench --with-mysql-includes=/usr/local/webserver/mysql/include/mysql/ --with-mysql-libs=/usr/local/webserver/mysql/lib/mysql
5 make #(问题二,三,四)
6 make install

 

问题一:

sysbench/tests/cpu/Makefile.am:17: The usual way to define `RANLIB' is to add `AC_PROG_RANLIB'
sysbench/tests/cpu/Makefile.am:17: to `configure.ac' and run `autoconf' again.
sysbench/tests/fileio/Makefile.am:17: library used but `RANLIB' is undefined
解决:根据下面代码编辑文件

1 vi configure.ac
2 # Checks for programs.
3 AC_PROG_CC
4 #AC_PROG_LIBTOOL
5 AC_PROG_RANLIB
6 AX_CHECK_DOCBOOK

 

问题二:
make的时候报错
make[3]: *** [libsbmysql_a-drv_mysql.o] Error 1
make[3]: Leaving directory `/data/software/sysbench-0.4.12/sysbench/drivers/mysql'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/data/software/sysbench-0.4.12/sysbench/drivers'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data/software/sysbench-0.4.12/sysbench'
make: *** [all-recursive] Error 1
解决方法:
由于linux上mysql版本为编译版本,需要指定库文件位置

1 ./configure --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql/

 

问题三:
make install报错
Fatal server error:
Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock
and start again.


Please consult the Red Hat, Inc. support
at https://www.redhat.com/apps/support/
for help.

../libtool: line 5172: : command not found

1 yum install libtool

 

问题四:
../libtool: line 2234: X-g: command not found
../libtool: line 2234: X-O2: command not found
../libtool: line 1954: X-L/usr/local/webserver/mysql/lib/mysql/: No such file or directory
../libtool: line 2403: Xsysbench: command not found
解决:
安装目录下运行 

1 cp /usr/bin/libtool libtool

 


测试:
官方手册 http://sysbench.sourceforge.net/docs/#database_mode

CPU:

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: 35.0112s
total number of events: 10000
total time taken by event execution: 35.0044
per-request statistics:
min: 3.08ms
avg: 3.50ms
max: 50.15ms
approx. 95 percentile: 3.80ms

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


OLTP (Mysql 测试):
1.准备数据

sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 --mysql-socket=/tmp/mysql.sock --mysql-user=root --mysql-db=test prepare

sysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysql
Creating table 'sbtest'...
Creating 1000000 records in table 'sbtest'...

2.测试

sysbench --num-threads=16 --max-requests=100000 --test=oltp --oltp-table-size=1000000 --mysql-socket=/tmp/mysql.sock --oltp-read-only --mysql-user=root --mysql-db=test run

sysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 16

Doing OLTP test.
Running mixed OLTP test
Doing read-only test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "LOCK TABLES READ" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 100000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 1400000
write: 0
other: 200000
total: 1600000
transactions: 100000 (240.50 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 1400000 (3366.95 per sec.)
other operations: 200000 (480.99 per sec.)

Test execution summary:
total time: 415.8071s
total number of events: 100000
total time taken by event execution: 6651.4308
per-request statistics:
min: 3.59ms
avg: 66.51ms
max: 1109.58ms
approx. 95 percentile: 96.25ms

Threads fairness:
events (avg/stddev): 6250.0000/181.55
execution time (avg/stddev): 415.7144/0.02

 

 

posted @ 2012-06-07 12:31  猪尬亮  阅读(1811)  评论(0编辑  收藏  举报