ubuntu 18.04使用sysbench测试MySQL性能
首先下载安装sysbench:
sudo apt-get install sysbench -y
查看一下sysbench版本是多少:
zifeiy@zifeiy-S1-Series:~$ sysbench --version
sysbench 1.0.11
这个版本根一些书上的比较旧的版本稍有一些参数不一样,要注意。
在MySQL中新建一个名为testdb的database:
mysql> CREATE DATABASE IF NOT EXISTS testdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected, 2 warnings (0.05 sec)
执行如下命令进行测试:
sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 prepare|run|cleanup
也就是分三步走:
1.准备数据
sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 prepare
显示信息:
zifeiy@zifeiy-S1-Series:~$ sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 prepare
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)
Initializing worker threads...
Creating table 'sbtest1'...
Creating table 'sbtest6'...
Creating table 'sbtest7'...
Creating table 'sbtest9'...
Creating table 'sbtest2'...Creating table 'sbtest8'...
Creating table 'sbtest4'...
Creating table 'sbtest5'...
Creating table 'sbtest10'...
Creating table 'sbtest3'...
Inserting 1000000 records into 'sbtest7'
Inserting 1000000 records into 'sbtest4'
Inserting 1000000 records into 'sbtest8'
Inserting 1000000 records into 'sbtest2'
Inserting 1000000 records into 'sbtest9'
Inserting 1000000 records into 'sbtest6'
Inserting 1000000 records into 'sbtest3'
Inserting 1000000 records into 'sbtest10'
Inserting 1000000 records into 'sbtest1'
Inserting 1000000 records into 'sbtest5'
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest6'...
Creating a secondary index on 'sbtest1'...
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest9'...
2.运行以测试
sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 run
显示信息:
zifeiy@zifeiy-S1-Series:~$ sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 run
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 128
Report intermediate results every 10 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 10s ] thds: 128 tps: 630.48 qps: 3826.40 (r/w/o: 0.00/2552.33/1274.07) lat (ms,95%): 580.02 err/s: 0.30 reconn/s: 0.00
[ 20s ] thds: 128 tps: 1911.67 qps: 11457.64 (r/w/o: 0.00/7633.90/3823.75) lat (ms,95%): 189.93 err/s: 0.40 reconn/s: 0.00
[ 30s ] thds: 128 tps: 2713.62 qps: 16306.79 (r/w/o: 0.00/10878.86/5427.93) lat (ms,95%): 114.72 err/s: 0.70 reconn/s: 0.00
[ 40s ] thds: 128 tps: 2571.20 qps: 15423.28 (r/w/o: 0.00/10280.98/5142.29) lat (ms,95%): 118.92 err/s: 1.00 reconn/s: 0.00
[ 50s ] thds: 128 tps: 2658.13 qps: 15944.05 (r/w/o: 0.00/10625.50/5318.55) lat (ms,95%): 108.68 err/s: 1.30 reconn/s: 0.00
[ 60s ] thds: 128 tps: 2601.99 qps: 15597.92 (r/w/o: 0.00/10395.75/5202.17) lat (ms,95%): 110.66 err/s: 1.00 reconn/s: 0.00
[ 70s ] thds: 128 tps: 2666.24 qps: 16016.36 (r/w/o: 0.00/10679.08/5337.29) lat (ms,95%): 112.67 err/s: 1.90 reconn/s: 0.00
[ 80s ] thds: 128 tps: 2403.12 qps: 14405.61 (r/w/o: 0.00/9599.07/4806.54) lat (ms,95%): 130.13 err/s: 0.60 reconn/s: 0.00
[ 90s ] thds: 128 tps: 2846.27 qps: 17099.03 (r/w/o: 0.00/11405.19/5693.84) lat (ms,95%): 102.97 err/s: 1.00 reconn/s: 0.00
[ 100s ] thds: 128 tps: 2759.08 qps: 16561.49 (r/w/o: 0.00/11042.22/5519.26) lat (ms,95%): 118.92 err/s: 1.10 reconn/s: 0.00
[ 110s ] thds: 128 tps: 2668.21 qps: 16006.77 (r/w/o: 0.00/10671.75/5335.02) lat (ms,95%): 112.67 err/s: 1.00 reconn/s: 0.00
[ 120s ] thds: 128 tps: 2571.56 qps: 15433.17 (r/w/o: 0.00/10286.65/5146.52) lat (ms,95%): 118.92 err/s: 1.10 reconn/s: 0.00
SQL statistics:
queries performed:
read: 0
write: 1160697
other: 580404
total: 1741101
transactions: 290145 (2417.05 per sec.)
queries: 1741101 (14504.22 per sec.)
ignored errors: 114 (0.95 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 120.0394s
total number of events: 290145
Latency (ms):
min: 1.36
avg: 52.94
max: 1248.60
95th percentile: 130.13
sum: 15361679.30
Threads fairness:
events (avg/stddev): 2266.7578/46.19
execution time (avg/stddev): 120.0131/0.01
3.清理数据
sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 cleanup
(电脑崩了一次~~重启)
显示信息:
zifeiy@zifeiy-S1-Series:~$ sysbench /usr/share/sysbench/oltp_write_only.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=testdb --db-driver=mysql --tables=10 --table_size=1000000 --report-interval=10 --threads=128 --time=120 cleanup
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)
Dropping table 'sbtest1'...
Dropping table 'sbtest2'...
Dropping table 'sbtest3'...
Dropping table 'sbtest4'...
Dropping table 'sbtest5'...
Dropping table 'sbtest6'...
Dropping table 'sbtest7'...
Dropping table 'sbtest8'...
Dropping table 'sbtest9'...
Dropping table 'sbtest10'...
ubuntu 18.04使用sysbench测试MySQL性能的更多相关文章
- Ubuntu 18.04上安装Apache, MySQL, PHP, LAMP
1.安装 Apache $ sudo apt update && sudo apt install apache2 中间会遇到停顿询问是否继续, 输入 y 然后 回车. 2.测试 Ap ...
- sysbench 测试mysql性能
===== #1sysbench --test=oltp --oltp-table-size=10000 --mysql-db=test --mysql-user=root --mysql-passw ...
- Ubuntu 18.04 使用Systemd管理MySQL 5.6
转自:https://blog.csdn.net/skykingf/article/details/45225981 如何用Systemd管理 general 包安装的MySQL呢? 首先看看yum安 ...
- Ubuntu 18.04 下如何配置mysql 及 配置远程连接
首先是大家都知道的老三套,啥也不说上来就放三个大招: sudo apt-get install mysql-server sudo apt isntall mysql-client sudo apt ...
- Ubuntu 18.04上安装 phpMyAdmin
我们将安装 phpMyAdmin 在 Ubuntu18.04 上配合 Apache 一起工作. 在安装 phpMyAdmin 之前需要已经安装了LAMP栈并提供了web页面. 如果没有安装可以参照 U ...
- Ubuntu 18.04 安装MySQL
最近在写东西的时候,需要用到MySQL,在网上查了一下,都说Ubuntu18.04不能安装MySQL5.7.22, 总觉的不可能,所以自己就研究了一下,然后分享给大家 工具/原料 VMware W ...
- 记录在Ubuntu 18.04系统中安装Apache, MySQL和PHP环境
虽然我们在Linux VPS.服务器安装WEB环境比较方便,可以选择面板或者一键包,但是有些我们需要深入学习的网友不会选择一键安装,而是会尝试编译安装.这样可以学到一些内在的技术.一般我们较为习惯选择 ...
- Ubuntu 18.04 系统配置 NPM环境和mysql数据库问题解决
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效. 今天我就为大家 使用 Ubun ...
- 在Ubuntu 18.04 安装 MySQL 8.0
在Ubuntu 18.04 安装 MySQL 8.0 ① 登入 mysql 官网,在官网中下载 deb 包,点击该链接,即可下载. https://dev.mysql.com/downloads/re ...
随机推荐
- CF827D Best Edge Weight 题解
题意: 给定一个点数为 n,边数为 m,权值不超过 \(10^9\) 的带权连通图,没有自环与重边. 现在要求对于每一条边求出,这条边的边权最大为多少时,它还能出现在所有可能的最小生成树上,如果对于任 ...
- YAML_01 YAML语法和playbook写法
ansible的playbook采用yaml语法,它简单地实现了json格式的事件描述.yaml之于json就像markdown之于html一样,极度简化了json的书写.在学习ansible pla ...
- bzoj 2969: 矩形粉刷 概率期望+快速幂
还是老套路:期望图上的格子数=$\sum$ 每个格子被涂上的期望=$\sum$1-格子不被图上的概率 这样的话就相对好算了. 那么,对于 $(i,j)$ 来说,讨论一下上,下,左,右即可. 然后发现四 ...
- Session的数据共享
要体现出Session的数据共享,需要建立两个Servlet: 第一个:建立Session,将值设置为Tom. protected void doGet(HttpServletRequest requ ...
- 【一起来烧脑】一步学会CSS3体系
[外链图片转存失败(img-yfi1VPyy-1563434266398)(https://upload-images.jianshu.io/upload_images/11158618-fc8784 ...
- windows--zabbix-agent添加主机
1.首先在 C 盘根目录下创建 zabbix 的文件夹 2.将需要的文件拖到该文件夹内(bin/win64) 3.修改 windows 配置文件(zabbix.agent.win.conf)的 ...
- spaceclaim脚本(线生成面体)
#新建一个列表,用来保存修剪曲线(PS:修建曲线的意思是开始点和结束点不在一起,圆就不属于修建曲线) #注意和Line,Circle类型等的区别 curves = List[ITrimmedCurve ...
- freemark 异常
现象: 前几天跟前端联调,freemark报异常如下: For "#if" condition: Expected a boolean, but this has evaluate ...
- 小福bbs-冲刺总结
[小福bbs-冲刺总结] 这个作业属于哪个课程 班级链接 这个作业要求在哪里 作业要求的链接 团队名称 小福bbs 这个作业的目标 冲刺总结 作业的正文 小福bbs-冲刺总结 其他参考文献 面向百度和 ...
- frp ssh反向代理配置使用
本质是一个内网反向代理工具,需要一个vps配合,因为要外网ip. 主页: https://github.com/fatedier/frp 1.服务端(VPS) 可以用下面的一键安装脚本,也可以用主页上 ...