udal导mysql_MySQL性能测试工具之mysqlslap
mysqlslap是mysql自带的基准测试工具,优点:查询数据,语法简单,灵活容易使用.该工具可以模拟多个客户端同时并发的向服务器发出查询更新,给出了性能测试数据而且提供了多种引擎的性能比较.msqlslap为mysql性能优化前后提供了直观的验证依据,建议系统运维和DBA人员应该掌握一些常见的压力测试工具,才能准确的掌握线上数据库支撑的用户流量上限及其抗压性等问题。
相关阅读:
1.工具详细参数
--help 显示帮助
--concurrency 代表并发数量,多个可以用逗号隔开
--engines 测试的引擎,多个用分隔符隔开
--iterations 运行这些测试多少次
--auto-generate-sql 系统自己生成的SQL脚本来测试
--auto-generate-sql-load-type 测试的是读还是写还是两者混合的(read,write,update,mixed)
--number-of-queries 总共要运行多少次查询
--debug-info 额外输出CPU以及内存的相关信息
--number-int-cols 创建测试表的 int 型字段数量
--auto-generate-sql-add-autoincrement 生成的表自动添加auto_increment列
--number-char-cols 测试表的 char 型字段数量
--create-schema 测试的database
--query 用自定义脚本执行测试
--only-print 如果只想打印看看SQL语句是什么,以用这个选项
2.测试实例(单个并发)
[root@node2 bin]# ./mysqlslap -uroot -psystem --concurrency=100 --iterations=1 --auto-generate-sql --auto-generate-sql-load-type=mixed --auto-generate-sql-add-autoincrement --engine=myisam --number-of-queries=10 --debug-info
Warning: Using a password on the command line interface can be insecure.
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.209 seconds
Minimum number of seconds to run all queries: 0.209 seconds
Maximum number of seconds to run all queries: 0.209 seconds
Number of clients running queries: 100
Average number of queries per client: 0
User time 0.02, System time 0.09
Maximum resident set size 4684, Integral resident set size 0
Non-physical pagefaults 1476, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 2797, Involuntary context switches 25
[root@node2 bin]#
说明:测试100个并发线程,测试次数1次,自动生成SQL测试脚本,读,写,更新混合测试,自增长字段,测试引擎为myisam,共运行10次查询,输出cpu资源信息
3.测试实例(多个并发)
[root@node2 bin]# ./mysqlslap --concurrency=50,100,200 --iterations=20 --number-int-cols=4 --number-char-cols=35 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read --engine=myisam,innodb --number-of-queries=200 --verbose --socket=/tmp/mysql.sock -uroot -psystem
Warning: Using a password on the command line interface can be insecure.
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.758 seconds
Minimum number of seconds to run all queries: 0.671 seconds
Maximum number of seconds to run all queries: 0.870 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.840 seconds
Minimum number of seconds to run all queries: 0.645 seconds
Maximum number of seconds to run all queries: 1.117 seconds
Number of clients running queries: 100
Average number of queries per client: 2
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.959 seconds
Minimum number of seconds to run all queries: 0.802 seconds
Maximum number of seconds to run all queries: 1.192 seconds
Number of clients running queries: 200
Average number of queries per client: 1
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.701 seconds
Minimum number of seconds to run all queries: 0.632 seconds
Maximum number of seconds to run all queries: 0.778 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.754 seconds
Minimum number of seconds to run all queries: 0.560 seconds
Maximum number of seconds to run all queries: 0.920 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.860 seconds
Minimum number of seconds to run all queries: 0.709 seconds
Maximum number of seconds to run all queries: 1.173 seconds
Number of clients running queries: 200
Average number of queries per client: 1
[root@node2 bin]#
说明:测试50,100,200个并发,运行20次,存储引擎myisam和innodb,运行200次查询
4.测试实例(自定义sql语句)
[root@node2 bin]# ./mysqlslap --concurrency=100 --iterations=1 --query='select * from tong.t;' --number-of-queries=10 --debug-info -uroot -psystem
Benchmark
Average number of seconds to run all queries: 2.211 seconds
Minimum number of seconds to run all queries: 2.211 seconds
Maximum number of seconds to run all queries: 2.211 seconds
Number of clients running queries: 100
Average number of queries per client: 0
User time 0.05, System time 0.27
Maximum resident set size 7324, Integral resident set size 0
Non-physical pagefaults 1686, Physical pagefaults 33, Swaps 0
Blocks in 7104 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 3449, Involuntary context switches 40
[root@node2 bin]#
5.测试实例(检测脚本)
[root@node2 bin]# ./mysqlslap --create=/yourpath/Test1.sql --query=/yourpath/Test2.sql --concurrency=50,100,200 --iterations=20 --engine=myisam,innodb -u root -psystem
udal导mysql_MySQL性能测试工具之mysqlslap相关推荐
- mysql查询性能测试工具_MySQL性能测试工具MySQLslap使用实例详解
原标题:MySQL性能测试工具MySQLslap使用实例详解 MySQLslap是MySQL(了解干货请戳:干货!超过500行的Mysql学习笔记)自带的基准测试工具,优点:查询数据,语法简单,灵活容 ...
- apache性能测试工具ab使用详解
网站性能压力测试是服务器网站性能调优过程中必不可缺少的一环.只有让服务器处在高压情况下,才能真正体现出软件.硬件等各种设置不当所暴露出的问题. 性能测试工具目前最常见的有以下几种:ab.http_lo ...
- Python性能测试工具汇总
目录 一.line_profiler 二.memory_profiler 三.timeit 四.pyheat 五.heartrate 六.Pycharm自带的Profiler工具 七.objgraph ...
- Python性能测试工具Locust入门
一.性能测试基础 1.性能测试该怎么做? 利用工具模拟真实用户操作. 2.性能测试基础: 性能:事物的性质和能效 -->效率性能 (时间/资源/容量) 思考:如何评价软件系统的性能? 快慢:衡量 ...
- MySql性能测试工具-sysbench
转自:MySql性能测试工具-sysbench - 没那么简单的博客 虽然mysql默认的有mysqlslap这个性能测试工具,但和sysbench比较来说,还逊色不少. 下载安装包 https:// ...
- mysql检测工具_MySQL性能测试工具
The MySQL Benchmark Suite.MySQL super-smack.MyBench.mysqlslap .除了第一个为MySQL性能测试工具,其他两个都为压力测试工具. 1. Th ...
- linux命令 iperf-网络性能测试工具
iperf命令是一个网络性能测试工具.iperf可以测试TCP和UDP带宽质量.iperf可以测量最大TCP带宽,具有多种参数和UDP特性.iperf可以报告带宽,延迟抖动和数据包丢失.利用iperf ...
- 深入浅出开源性能测试工具 Locust (使用篇 1)
在<[LocustPlus序]漫谈服务端性能测试>中,我对服务端性能测试的基础概念和性能测试工具的基本原理进行了介绍,并且重点推荐了Locust这一款开源性能测试工具.然而,当前在网络上针 ...
- python编写测试工具-python 写一个性能测试工具(一)
国庆重新学习了一下go的gin高性能测试框架. 用JMeter来测试gin与flask接口的性能,差别很大. 为什么我自己不尝试写一个性能工具,性能工具的核心就是 并发 和 请求. 请求可以选择Pyt ...
- 史上最全的Web性能测试工具大全(下 )
2019独角兽企业重金招聘Python工程师标准>>> 本文继续为大家介绍Web开发中常用的性能测试工具,如果你有其他性能测试产品推荐,欢迎交流! Opera Dragonfly O ...
最新文章
- error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h
- Java队列 Deque
- 设计模式札记——单例模式(Singleton Pattern)
- Connect 大会的主题 ---微软大法好
- Flink 在 58 同城的应用与实践
- Java SAO操作-使用lambda代替字符串
- next_day函数用法
- GAN_1——基础知识
- 神经网络参数个数计算,神经网络的参数设置
- android app启动图片 加动画效果,Android Studio开发APP启动程序时开屏简单动画效果快速有效解决方案...
- B站:你阳了和我裁员有什么关系
- 美团技术总结:Java中9种常见的CMS GC问题分析与解决
- Css打造一个简单的静态七巧板
- 雷达图-高效数据解读
- 解决org.springframework.beans.factory.NoUniqueBeanDefinitionException No qualifying bean of type
- Linux系统下修改mysql数据库密码
- mysql索引的数据结构,各自优劣
- python人脸识别理论_简述几种人脸识别的主要方法
- 现在怎么用python 爬取微信的聊天记录
- Vue.js获取data-*的值