Ubuntu下MySQL性能测试之super-smack
1.安装MySQL
不要使用apt-get install mysql-server-5.x
使用编译安装或者解压安装MySQL
2.安装配置super-smack
wget http://vegan.net/tony/supersmack/super-smack-1.3.tar.gz
tar zxvf super-smack-1.3.tar.gz
cd super-smack-1.3
3.修改源代码,不然会在安装过程中报错
cd src
nano dictionary.h
添加
#include <cstring>
4.安装flex
apt-get install flex
5.安装Yacc
wget http://invisible-island.net/datafiles/release/byacc.tar.gz
tar zxvf byacc.tar.gz
cd byacc
./configure
make
make install
6.配置
./configure --prefix=/usr/local/supersmack --with-mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
7.复制make所需
cp /usr/local/mysql/libmysqlclient.so.16 /usr/lib
8.make
没有出现错误则配置成功
9.make install
10.配置测试
cp /usr/share/smacks/select-key.smack /usr/local/supersmack/bin/select-key.smack
cp /usr/share/smacks/update-select.smack /usr/local/supersmack/bin/update-select.smack
修改数据库用户名和密码
nano /usr/local/supersmack/bin/select-key.smack
nano /usr/local/supersmack/bin/update-select.smack
1)word.data修改为http_auth.data
2)gen_data_file "/usr/local/supersmack/bin/gen-data -n 90000 -f %12-12s%n %25-25s %n %d";
中","用TAB
3)delim用TAB替换","
11.测试
测试MYISAM表的性能
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/select-key.smack 10 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/select-key.smack 100 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/update-select.smack 10 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/update-select.smack 100 1000
测试innodb 表
mysql -uroot -proot
use test
alter table http_auth engine innodb;
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/select-key.smack 10 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/select-key.smack 100 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/update-select.smack 10 1000
/usr/local/supersmack/bin/super-smack -d mysql /usr/local/supersmack/bin/update-select.smack 100 1000
12.测试结果
Query Barrel Report for client smacker1
connect: max=6ms min=1ms avg= 3ms from 100 clients
Query_type num_queries max_time min_time q_per_s
select_index 200000 5 0 36085.05
如果不能生成测试数据手动导入测试数据
/usr/local/supersmack/bin/gen-data -n 90000 -f %12-12s%n,%25-25s,%n,%d > /var/smack-data/http_auth.dat
mysqlimport -L -uroot -proot test /var/smack-data/http_auth.dat