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 ...
随机推荐
- 入门node.js
我们现在要做一个简单的h5应用:包含登录.注册.修改密码.个人中心主页面.个人中心内页修改名称.个人中心修改手机号码. 第一步:工具安装,我选择了能够辅助我们快速开发的light开发工具 1. lig ...
- webuploader+php如何实现分片+断点续传
这里只写后端的代码,基本的思想就是,前端将文件分片,然后每次访问上传接口的时候,向后端传入参数:当前为第几块文件,和分片总数 下面直接贴代码吧,一些难懂的我大部分都加上注释了: 上传文件实体类: 看得 ...
- 用provide/inject来实现简单的vuex状态管理功能
在开发的时候,经常会涉及到组件之间的通信.简单的有父子组件的通信,兄弟组件的通信通常可以借助Bus来进行.当然也可以用vuex来进行状态管理,但是,有时候用vuex未免有把简单的问题复杂化. 如果要进 ...
- P3388 【模板】割点(割顶)&& 桥
题目背景 割点 题目描述 给出一个n个点,m条边的无向图,求图的割点. 输入输出格式 输入格式: 第一行输入n,m 下面m行每行输入x,y表示x到y有一条边 输出格式: 第一行输出割点个数 第二行按照 ...
- kindle touch 5.1.2 update your kindle 灰色 解决办法
要出差了,于是把抽屉里的老Kindle Touch拿出来想升个级,baidu说多看费电,果断卸了用原生. 但是原生里面升级选项“update your kindle”是灰色的,没法点,怎么办? 试了半 ...
- for循环实战性能优化之使用Map集合优化
笔者在<for循环实战性能优化>中提出了五种提升for循环性能的优化策略,这次我们在其中嵌套循环优化小循环驱动大循环的基础上,借助Map集合高效的查询性能来优化嵌套for循环 ...
- Java 中List集合中自定义排序
/* 集合框架的工具类. Collections:集合框架的工具类.里面定义的都是静态方法. Collections和Collection有什么区别? Collection是集合框架中的一个顶层接口, ...
- 急急急,tp5的验证码不显示
本地环境phpstudy,使用composer安装tp5,按照看云<ThinkPHP5.0完全开发手册>验证码配置,就是不显示验证码. 使用:<div>{:captcha_im ...
- 配置Windows实例NTP服务
本文介绍如何开启和配置Windows NTP服务,保证实例本地时间精确同步. Windows实例NTP服务介绍 目前,所有地域下ECS实例默认采用CST(China Standard Time)时区, ...
- oracle清理归档日志(缓存)
1.用RMAN连接目标DB: rman target / RMAN target sys/*****@orcl 2.在RMAN命令窗口中,输入如下命令(清理所有的归档日志): crosscheck a ...