码迷,mamicode.com
首页 > 数据库 > 详细

MySQL性能测试工具 mysqlslap

时间:2014-12-09 19:49:03      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:mysql性能测试 mysqlslap

1.使用自动生成脚本测试数据库性能

mysqlslap -uroot -p123 -a --debug-info --concurrency=50,100  --number-of-queries=200 --engine=myisam,innodb

参数介绍 

-u : 用户名

-p : 密码

-a (--auto-generate-sql) : 自动生成sql脚本测试数据库

--debug-info : 输出debug信息,包括内存,CPU等

--concurrency : 用户并发数,可填写多个

--number-of-queries : 每个用户的查询次数

--engine : 需要测试的数据库引擎

输出结果:

Benchmark
        Running for engine myisam
        Average number of seconds to run all queries: 0.029 seconds
        Minimum number of seconds to run all queries: 0.029 seconds
        Maximum number of seconds to run all queries: 0.029 seconds
        Number of clients running queries: 50
        Average number of queries per client: 4

Benchmark
        Running for engine myisam
        Average number of seconds to run all queries: 0.026 seconds
        Minimum number of seconds to run all queries: 0.026 seconds
        Maximum number of seconds to run all queries: 0.026 seconds
        Number of clients running queries: 100
        Average number of queries per client: 2

Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.037 seconds
        Minimum number of seconds to run all queries: 0.037 seconds
        Maximum number of seconds to run all queries: 0.037 seconds
        Number of clients running queries: 50
        Average number of queries per client: 4

Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.040 seconds
        Minimum number of seconds to run all queries: 0.040 seconds
        Maximum number of seconds to run all queries: 0.040 seconds
        Number of clients running queries: 100
        Average number of queries per client: 2

 

2.使用自定义SQL语句测试指定数据库

mysqlslap -uroot -plewis0913 --create-schema="test" --query="select * from user;" --concurrency=50,100 --debug-info

参数介绍

--create-schema : 需要测试的数据库

--query : 需要测试的sql语句

输出结果:

Benchmark
       Average number of seconds to run all queries: 2.029 seconds
       Minimum number of seconds to run all queries: 2.029 seconds
       Maximum number of seconds to run all queries: 2.029 seconds
       Number of clients running queries: 50
       Average number of queries per client: 1

Benchmark
       Average number of seconds to run all queries: 2.544 seconds
       Minimum number of seconds to run all queries: 2.544 seconds
       Maximum number of seconds to run all queries: 2.544 seconds
       Number of clients running queries: 100
       Average number of queries per client: 1

本文出自 “fire” 博客,请务必保留此出处http://fire7758.blog.51cto.com/993821/1588034

MySQL性能测试工具 mysqlslap

标签:mysql性能测试 mysqlslap

原文地址:http://fire7758.blog.51cto.com/993821/1588034

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!