Super Smack安装和使用

我是在自己的ubuntun的环境下安装的。

1. 下载:

http://jeremy.zawodny.com/mysql/super-smack/

上面的网站上只有1.2的版本。

wget http://vegan.net/tony/supersmack/super-smack-1.3.tar.gz
这个是1.3的版本。

2. 安装:

1) ./configure --prefix=/usr/local/super-smack-1.3 --with-mysql=/usr/local/mysql-5.1.52  --with-mysql-lib=/usr/local/mysql-5.1.52/lib/mysql/ --with-mysql-include=/usr/local/mysql-5.1.52/include/mysql/

需要安装lex:sudo apt-get install flex bison

2) make

$ make
make  all-recursive
make[1]: 正在进入目录 `/home/xn/下载/super-smack-1.2'
Making all in src
make[2]: 正在进入目录 `/home/xn/下载/super-smack-1.2/src'
c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/mysql-5.1.52/include/mysql/      -g -O2 -c super-smack.cc
In file included from client.h:29:0,
                 from super-smack.cc:38:
dictionary.h: In member function ‘void Unique_dictionary::set_template(const char*)’:
dictionary.h:93:28: error: ‘strlen’ was not declared in this scope
super-smack.cc: In function ‘void set_parse_file(char*)’:
super-smack.cc:65:55: warning: deprecated conversion from string constant to ‘char*’
super-smack.cc: In function ‘void set_db_type(const char*)’:
super-smack.cc:72:48: warning: deprecated conversion from string constant to ‘char*’
super-smack.cc: In function ‘void print_engines()’:
super-smack.cc:126:55: error: ‘strlen’ was not declared in this scope
make[2]: *** [super-smack.o] 错误 1
make[2]:正在离开目录 `/home/xn/下载/super-smack-1.2/src'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/xn/下载/super-smack-1.2'
make: *** [all-recursive-am] 错误 2

解决方法:在src目录下修改 dictionary.h 和 super-smack.cc 增加#include <string.h>

64位系统下,query.cc 可能报错:

query.cc:200: error: cast from ‘char*’ to ‘unsigned int’ loses precision
query.cc:200: error: cast from ‘char*’ to ‘unsigned int’ loses precision
query.cc:219: error: cast from ‘char*’ to ‘unsigned int’ loses precision
query.cc:219: error: cast from ‘char*’ to ‘unsigned int’ loses precision

解决方法:修改src/query.cc中对应行,将unsigned改为unsigned long

3) sudo make install

3. 使用:

1) 安装成功之后,会有这样的几个地方有super smack相关的文件:

/usr/local/super-smack-1.3/ : super smack binaries.

/usr/share/smacks/ : test scripts

/var/smack-data/: default super smack source data dir, user could use -D to specify the data dir for smack.

tree /usr/local/super-smack-1.3/
/usr/local/super-smack-1.3/
└── bin
    ├── gen-data
    └── super-smack

tree /usr/share/smacks/
/usr/share/smacks/
├── select-key.smack
└── update-select.smack

tree /var/smack-data/
/var/smack-data/

2) 测试步骤:

i) 生成原始数据文件。文件名必须是words.dat。super smack会去dir下面找文件名为words.dat的文件进行load file。

      -f参数代表了测试数据的schema。

./gen-data -n 9000 -f %12-12s%n,%25-25s,%n,%d > /tmp/data/words.dat 

ii) 修改/usr/share/smacks/select-key.smack中mysql的连接参数:user/password/socket/host/port等参数信息。

iii) 开启super smack压力测试:

参数解析:-d 数据库类型, -D 原始数据目录,10表示10个线程,9000表示每个线程9000个query。(为什么总的query数是10*9000*2 ?)

./super-smack -d mysql select-key.smack -D /tmp/data/ 10 9000

iv) 测试结果:

./super-smack -d mysql  -D /tmp/data /usr/share/smacks/select-key.smack  10 9000
Table 'http_auth' does not meet condtions, will be dropped
Creating table 'http_auth'
Loading data from file '/tmp/data/words.dat' into table 'http_auth'
Table http_auth is now ready for the test
Query Barrel Report for client smacker1
connect: max=15ms  min=0ms avg= 6ms from 10 clients
Query_type    num_queries    max_time    min_time    q_per_s
select_index    180000    1    0    16862.91



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值