Rumah > Artikel > pangkalan data > mysql 高性能压力测试(总结了好久)
前言:根据业务需要,需测试mysql性能和压力测试.这里我说下测试方法和测试过程以及测试中出错的问题估计很多人跟我一样要测试mysql的性能压力,网上找了很多资
前言:根据业务需要,需测试mysql 性能和压力测试.
这里我说下测试方法和 测试过程以及测试中出错的问题
估计很多人 跟我一样 要测试mysql 的性能 压力,网上找了很多资料有很多,但是很乱,所以这里我做个总结,拿自己的真实服务器测试的。并且 想测多少数据 都能模拟出来!这里只介绍方法。
MySQL从5.1.4版开始带有一个压力测试工具mysqlslap,通过模拟多个并发客户端访问
mysql来执行测试。
分别 测试 myisam 和 innodb 引擎
Benchmark Running for engine myisam Average number of seconds to run all queries: 0.638 seconds Minimum number of seconds to run all queries: 0.565 seconds Maximum number of seconds to run all queries: 0.924 seconds Number of clients running queries: 50 Average number of queries per client: 20 Benchmark Running for engine myisam Average number of seconds to run all queries: 0.691 seconds Minimum number of seconds to run all queries: 0.686 seconds Maximum number of seconds to run all queries: 0.696 seconds Number of clients running queries: 100 Average number of queries per client: 10 Benchmark Running for engine innodb Average number of seconds to run all queries: 13.189 seconds Minimum number of seconds to run all queries: 12.886 seconds Maximum number of seconds to run all queries: 13.337 seconds Number of clients running queries: 50 Average number of queries per client: 20 Benchmark Running for engine innodb Average number of seconds to run all queries: 12.449 seconds Minimum number of seconds to run all queries: 12.299 seconds Maximum number of seconds to run all queries: 12.592 seconds Number of clients running queries: 100 Average number of queries per client: 10这个工具 无法 自己规定 多少数据,所以我后来 有拿了 super smack 工具测试
要去网上下载 vegan.net/tony/supersmack/super-smack-1.3.tar.gz
tar zxvf super-smack-1.3.tar.gz cd super-smack-1.3 ./configure --prefix=/usr/local/super-smack-1.3 --with-mysql=/usr/local/mysql/ --with-mysql-lib=/usr/local/mysql/lib/mysql/ --with-mysql-include=/usr/local/mysql/include/mysql/编译过程后 make 会报错
而且还要修改配置文件
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[1]: *** [all-recursive] 错误 1 make: *** [all-recursive-am] 错误 2要修改相应的配置文件才行
编译之前修改文件super-smack-1.3/src/query.cc 第193行: long len = 0; int num_recs = 0; 第199,200行 long str_len = (*i).first.length(); > if((long)p + str_len + 3 *sizeof(int) len = (long)p - (long)buf;这个我是看了相应教程 找了好久才发现的!
make make install介绍相应参数:
开头要修改 密码默认文件
vi select-key.smack