mysql sysbench基准测试
git项目地址:
https://github.com/akopytov/sysbench
利用sysbench很容易对mysql做性能基准测试(当然这个工具很强大,除了测试主流数据库性能,还能测试其它方面,详情自己看官网项目文档)
Linux上的用法:
一、安装
yum install -y sysbench
二、先在mysql上创建一个专门的测试数据库,比如sbtest
FATAL: unable to connect to MySQL server, aborting...
FATAL: error 1049: Unknown database 'sbtest' |
FATAL: failed to connect to database server! |
... |
错误提示说:mysql连接不上, sbtest库没找到。 需要创建一个sbtest库!
sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --db-driver=mysql --mysql-host=192.168.60.165 --mysql-port=18604 --mysql-user=root --mysql-password=cc.123 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 prepare
--test=tests/db/oltp.lua 表示调用 tests/db/oltp.lua 脚本进行 oltp 模式测试
--oltp_tables_count=10 表示会生成 10 个测试表
--oltp-table-size=100000 表示每个测试表填充数据量为 100000
--rand-init=on 表示每个测试表都是用随机数据来填充的
真实测试场景中,数据表建议不低于10个,单表数据量不低于500万行,当然了,要视服务器硬件配置而定。如果是配备了SSD或者PCIE SSD这种高IOPS设备的话,则建议单表数据量最少不低于1亿行。
真实测试场景中,建议持续压测时长不小于30分钟,否则测试数据可能不具参考意义。
三、利用sysbench先生成测试数据
sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --db-driver=mysql --mysql-host=192.168.60.165 --mysql-port=18604 --mysql-user=root --mysql-password=cc.123 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 run >> /home/mysysbench.log
sysbench : multi-threaded system evaluation benchmark Running the test with following options:
Number of threads: 8
Report intermediate results every 10 second(s)
Random number generator seed is 0 and will be ignored Threads started!
-- 每10秒钟报告一次测试结果,tps、每秒读、每秒写、99%以上的响应时长统计
[ 10s] threads: 8, tps: 1111.51, reads/s: 15568.42, writes/s: 4446.13, response time: 9.95ms (99%)
[ 20s] threads: 8, tps: 1121.90, reads/s: 15709.62, writes/s: 4487.80, response time: 9.78ms (99%)
[ 30s] threads: 8, tps: 1120.00, reads/s: 15679.10, writes/s: 4480.20, response time: 9.84ms (99%)
[ 40s] threads: 8, tps: 1114.20, reads/s: 15599.39, writes/s: 4456.30, response time: 9.90ms (99%)
[ 50s] threads: 8, tps: 1114.00, reads/s: 15593.60, writes/s: 4456.70, response time: 9.84ms (99%)
[ 60s] threads: 8, tps: 1119.30, reads/s: 15671.60, writes/s: 4476.50, response time: 9.99ms (99%)
OLTP test statistics:
queries performed:
read: 938224 -- 读总数
write: 268064 -- 写总数
other: 134032 -- 其他操作总数(SELECT、INSERT、UPDATE、DELETE之外的操作,例如COMMIT等)
total: 1340320 -- 全部总数
transactions: 67016 (1116.83 per sec.) -- 总事务数(每秒事务数)
deadlocks: 0 (0.00 per sec.) -- 发生死锁总数
read/write requests: 1206288 (20103.01 per sec.) -- 读写总数(每秒读写次数)
other operations: 134032 (2233.67 per sec.) -- 其他操作总数(每秒其他操作次数) General statistics: -- 一些统计结果
total time: 60.0053s -- 总耗时
total number of events: 67016 -- 共发生多少事务数
total time taken by event execution: 479.8171s -- 所有事务耗时相加(不考虑并行因素)
response time: -- 响应时长统计
min: 4.27ms -- 最小耗时
avg: 7.16ms -- 平均耗时
max: 13.80ms -- 最长耗时
approx. 99 percentile: 9.88ms -- 超过99%平均耗时 Threads fairness:
events (avg/stddev): 8377.0000/44.33
execution time (avg/stddev): 59.9771/0.00
测试完成执行cleanup
测试结束后,记得执行cleanup,以确保测试所产生的文件都已删除
mysql sysbench基准测试的更多相关文章
- MySQL服务器基准测试
一.基准测试简介 1.什么是基准测试 数据库的基准测试是对数据库的性能指标进行定量的.可复现的.可对比的测试. 基准测试与压力测试 基准测试可以理解为针对系统的一种压力测试.但基准测试不关心业务逻辑, ...
- sysbench基准测试(2)——oltp.lua测试
前面知道sysbench基准测试的主要步骤为:prepare(准备数据集)→ run(运行测试)→ cleanup(清除数据集) 这一节介绍oltp.lua测试. oltp基准测试模拟了一个简单的事物 ...
- Sysbench对Mysql进行基准测试
前言 1.基准测试(benchmarking)是性能测试的一种类型,强调的是对一类测试对象的某些性能指标进行定量的.可复现.可对比的测试. 进一步来理解,基准测试是在某个时候通过基准测试建立一个已知的 ...
- 利用sysbench进行MySQL OLTP基准测试
Preface In order to know clearly about the real performance threshold of database server,we ...
- mysql benchmark基准测试
git项目地址: https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试(当然这个工具很强大,除了测试主流数据库性能,还能测试其 ...
- MySQL性能基准测试对比:5.7 VS 8.0
本文由云+社区发表 作者:数据库 版权声明:本文由腾讯云数据库产品团队整理,页面原始内容来自于severalnines英文官网,若转载请注明出处.翻译目的在于传递更多全球最新数据库领域相关信息,并不意 ...
- 基于mysql的基准测试
常用的基准测试工具介绍: mysql基准测试工具: mysqlslap,mysql自带的工具,对于性能测试不建议使用 特点: 可以模拟服务器负载,并输出相关统计信息 可以指定也可以自动生成查询语句 常 ...
- sysbench基准测试工具
一.简介SysBench是一个模块化的.跨平台.多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况.当前功能允许测试的系统参数有:file I/O performance (文件I ...
- sysbench基准测试工具使用
1.源码编译安装 源码下载地址(目前有0.4/0.5/1.0三个分支版本):https://github.com/akopytov/sysbench 编译安装: unzip sysbench-1.0. ...
随机推荐
- 转自ruby迷: 使用Net::SSH和Net::SCP编写Linux服务器管理脚本
试了一下perl下安装ssh模块,整了半天linux/window上都装不上,各依赖模块的版本总是匹配不上,后改了一下思路,用ruby吧 Net::SSH和Net::SCP是两个Ruby操作SSH的g ...
- [Python] Python 虚拟机 - virtualenv
virtualenv virtualenv 用于创建一个隔离的 Python 环境. 每个项目都有自己的依赖包,这些依赖包有时存在版本冲突,处理这种情况最好方法就是为每个项目创建一个专属的环境. 安装 ...
- python通过get,post方式发送http请求和接收http响应的方法,pythonget
python通过get,post方式发送http请求和接收http响应的方法,pythonget 本文实例讲述了python通过get,post方式发送http请求和接收http响应的方法.分享给大家 ...
- 127、Universal-Image-Loader解析(转载)(图片加载)
(一)——ImageLoaderConfiguration的详细配置http://www.cnblogs.com/tianzhijiexian/p/4034215.html (二)——DisplayI ...
- Ubuntu下SSH无密码验证配置
前言 SSH为Secure Shell 的缩写,是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议.越来越多的小伙伴们使用远程登录,而ssh安全性无疑是很高的,那么我们现在来看看如何实现ss ...
- Get Started with the Google Fonts API
Get Started with the Google Fonts API This guide explains how to use the Google Fonts API to add fon ...
- C - 取石子游戏
1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍.取完者胜.先取者负输出"Second win".先取者胜输出&q ...
- 前端基础开发之HTML
简介: 1.HTML是什么? htyper ...
- db2 Reorgchk:重组检查,是否需要重组
Reorgchk:重组检查,是否需要重组.判断表或索引是否需要重组,有2种方法:1.通过reorgchk工具 reorgchk工具利用8个公式(3个表公式,5个索引公式),如果表统计结果F1,F2或 ...
- limits.conf文件修改注意事项
limits.conf文件限制着用户可以使用的最大文件数,最大线程,最大内存等资源使用量. vim /etc/security/limits.conf * soft nofile * hard nof ...