> 数据库 > MySQL >

对MYSQL进行压力测试

1、安装supersmack
http://vegan.net/tony/supersmack/
安装过程以及我中间遇到问题的总结都在这里。
之前记得把libmysqlclient.so.16拷贝到/usr/lib中去,这样make 的时候不用改MakeFile文件。
[root@localhost super-smack-1.3]# cp /usr/local/mysql/libmysqlclient.so.16 /usr/lib
[root@localhost rpmpackage]# cd ../sourcepackage/super-smack-1.2
[root@localhost super-smack-1.2]# ./configure --with-mysql
loading cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
...
updating cache ./config.cache
creating ./config.status
creating Makefile
creating src/Makefile
creating config.h


Building with the following options:

MySQL Support..................... yes
PostgreSQL Support................ no
Oracle Support.................... no

If this is not what you intended, please re-run configure.

Thanks for using super-smack!
然后make;make install

2、进行实际测试。
拷贝示例文件。
[root@localhost super-smack-1.3]# cp -r smacks/ /usr/local/bin/
修改用户名和密码为自己的
[root@localhost smacks]# super-smack -d mysql select-key.smack 10 10000
10 是连接客户的数目,每个客户有10000次轮询。

默认是测试MYISAM表的性能。
mysql> alter table http_auth engine myisam;

Query Barrel Report for client smacker1
connect: max=358ms  min=0ms avg= 93ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       36678.87

Query Barrel Report for client smacker1
connect: max=2ms  min=0ms avg= 0ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       36312.06

下来测试innodb表,修改表类型
mysql> alter table http_auth engine innodb;

Query Barrel Report for client smacker1
connect: max=50ms  min=0ms avg= 16ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       39852.46

Query Barrel Report for client smacker1
connect: max=8ms  min=0ms avg= 3ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       38331.63


接下来内存类型
mysql> alter table http_auth engine memory;

Query Barrel Report for client smacker1
connect: max=243ms  min=0ms avg= 26ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       45608.34

Query Barrel Report for client smacker1
connect: max=139ms  min=0ms avg= 55ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       43428.97

接下来测试集群的
mysql> alter table http_auth engine ndb;

Query Barrel Report for client smacker1
connect: max=0ms  min=0ms avg= 0ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       19831.67

Query Barrel Report for client smacker1
connect: max=2ms  min=0ms avg= 0ms from 10 clients
Query_type      num_queries     max_time        min_time        q_per_s
select_index    200000  0       0       20116.44

这个测试结果怎么表名MYISAM表的SELECT比INNODB的还差,MEMORY最快,毕竟是用内存。

看一下update的。
[root@localhost smacks]# super-smack -d mysql update-select.smack 10 10000


(责任编辑:IT)