日期:2014-05-16  浏览次数:20523 次

super-smack-1.3 mysql数据库测试工具安装
一、下载

super-smack

下载地址:http://vegan.net/tony/supersmack/

源码:http://vegan.net/tony/supersmack/super-smack-1.3.tar.gz

二、编译及安装

配置编译选项(进入super-smack-1.3目录):./configure --prefix=/usr/local/super-smack-1.3 --with-mysql --with-smacks-dir=/usr/local/super-smack-1.3

请根据测试的数据库来选择 --with-pgsql --with-oracle 或 --with-mysql

重点说明一下--with-mysql的编译配置:

编译的时候要把/usr/lib64目录下的libmysqlclient.so.16放到/usr/lib目录下,否则会出现下面的错误:

configure: error: Could not find libmysqlclient in ' /usr/lib /usr/lib/mysql                    /usr/local/lib /usr/local/lib/mysql                    /usr/local/mysql/lib

configure: error: Could not find mysql.h in ' /usr/include /usr/include/mysql                        /usr/local/include /usr/local/include/mysql                        /usr/local/mysql/include'

由于我的mysql是自行编译的,所以我这样操作

cd /usr/include; ln -s /usr/local/mysql/include/mysql

cd /usr/lib; ln -s /usr/local/mysql/lib/mysql

编译及安装:
make;make install

三、使用方法及常见问题

为方便使用

ln -s /usr/local/super-smack/bin/super-smack /usr/local/bin/

ln -s /usr/local/super-smack/bin/gen-data /usr/local/bin/

使用方法:

cd /usr/lib;ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16.0.0 libmysqlclient.so.16

或者

cd /usr/lib;cp -a /usr/local/mysql/lib/mysql/libmysqlclient.so.16.0.0 libmysqlclient.so.16

否则会有如下问题:

# super-smack -d mysql /usr/local/super-smack/select-key.smack 10 1000

super-smack: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

注意可能要根据实际情况修改select-key.smack文件中数据库连接部分的配置。

注意还需要指定select-key.smack 文件的具体位置,否则会出现下面的错误提示。

# super-smack select-key.smack 10 1000

super-smack: Could not open input file select-key.smack errno = 2, error is No such file or directory

四、正常使用的范例

[root@MySQL lib]# super-smack -d mysql /usr/local/super-smack/select-key.smack 10 1000      

Error running query select count(*) from http_auth:Table 'test.http_auth' doesn't exist

Creating table 'http_auth'

Populating data file '/var/smack-data/words.dat' with shell command 'gen-data -n 90000 -f %12-12s%n,%25-25s,%n,%d'

Loading data from file '/var/smack-data/words.dat' into table 'http_auth'

Table http_auth is now ready for the test

Query Barrel Report for client smacker1

connect: max=2809ms  min=3ms avg= 586ms from 10 clients

Query_type      num_queries     max_time        min_time        q_per_s

select_index    20000   0       0       2243.93