sysbench对MySQL的压测,使用sysbench压测磁盘io
QPS - query per second
TPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的
Ⅰ、sysbench测试框架
Ⅱ、常用测试脚本
[root@VM_42_63_centos lua]# pwd
/usr/local/src/sysbench-master/src/lua
[root@VM_42_63_centos lua]# ll *.lua
-rwxr-xr-x 1 root root 1446 Jun 27 02:35 bulk_insert.lua
-rw-r--r-- 1 root root 1307 Jun 27 02:35 empty-test.lua
-rw-r--r-- 1 root root 14468 Jun 27 02:35 oltp_common.lua
-rwxr-xr-x 1 root root 1290 Jun 27 02:35 oltp_delete.lua
-rwxr-xr-x 1 root root 2415 Jun 27 02:35 oltp_insert.lua
-rwxr-xr-x 1 root root 1265 Jun 27 02:35 oltp_point_select.lua
-rwxr-xr-x 1 root root 1649 Jun 27 02:35 oltp_read_only.lua
-rwxr-xr-x 1 root root 1824 Jun 27 02:35 oltp_read_write.lua
-rwxr-xr-x 1 root root 1118 Jun 27 02:35 oltp_update_index.lua
-rwxr-xr-x 1 root root 1127 Jun 27 02:35 oltp_update_non_index.lua
-rwxr-xr-x 1 root root 1440 Jun 27 02:35 oltp_write_only.lua
-rw-r--r-- 1 root root 1631 Jun 27 02:35 prime-test.lua
-rwxr-xr-x 1 root root 1933 Jun 27 02:35 select_random_points.lua
-rwxr-xr-x 1 root root 2132 Jun 27 02:35 select_random_ranges.lua
Ⅲ、开搞
这个老版本好像有参数设置热数据的量什么的,现在最新版本不知道咋搞,就先将就直接弄吧,不管了
准备数据
[root@VM_42_63_centos lua]# sysbench --mysql-host=127.0.0.1 --mysql-port=3307 --mysql-db=sbtest --tables=10 --table-size=10000 --mysql-user=root --mysql-password=123 oltp_update_index.lua prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 10000 records into 'sbtest2'
Creating a secondary index on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 10000 records into 'sbtest3'
Creating a secondary index on 'sbtest3'...
...
开始测试
[root@VM_42_63_centos lua]# sysbench oltp_update_index.lua --mysql-host=127.0.0.1 --mysql-port=3307 --mysql-user=root --mysql-password=123 --threads=10 --time=120 --report-interval=10 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 10
Report intermediate results every 10 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 10s ] thds: 10 tps: 804.14 qps: 804.14 (r/w/o: 0.00/804.14/0.00) lat (ms,95%): 36.89 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 10 tps: 647.70 qps: 647.70 (r/w/o: 0.00/647.70/0.00) lat (ms,95%): 35.59 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 10 tps: 2220.50 qps: 2220.50 (r/w/o: 0.00/2220.50/0.00) lat (ms,95%): 18.28 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 10 tps: 4566.59 qps: 4566.59 (r/w/o: 0.00/4566.59/0.00) lat (ms,95%): 2.71 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 10 tps: 4194.30 qps: 4194.30 (r/w/o: 0.00/4194.30/0.00) lat (ms,95%): 7.30 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 10 tps: 4717.91 qps: 4717.91 (r/w/o: 0.00/4717.91/0.00) lat (ms,95%): 2.76 err/s: 0.00 reconn/s: 0.00
...
看结果,这里就不解释了,比较简单,随便看看就好
SQL statistics:
queries performed:
read: 0
write: 665574
other: 0
total: 665574
transactions: 665574 (5546.21 per sec.)
queries: 665574 (5546.21 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
Throughput:
events/s (eps): 5546.2076
time elapsed: 120.0052s
total number of events: 665574
Latency (ms):
min: 0.27
avg: 1.80
max: 123.45
95th percentile: 2.43
sum: 1199263.13
Threads fairness:
events (avg/stddev): 66557.4000/209.28
execution time (avg/stddev): 119.9263/0.00
使用sysbench压测磁盘io
Ⅰ、sysbench安装
cd /usr/local/src
yum -y install make automake libtool pkgconfig libaio-devel
git clone https://github.com/akopytov/sysbench.git
cd sysbench
./autogen.sh
./configure
make -j 4
make install
ldconfig /usr/local/mysql/lib
[root@VM_42_63_centos sysbench]# sysbench --version;
sysbench 1.1.0-50966c8
Ⅱ、file io测试
2,1 生成测试文件
sysbench fileio --file-num=4 --file-block-size=16384 --file-total-size=110G prepare
2.2 看下参数
[root@VM_42_63_centos data]# sysbench fileio help
sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3)
fileio options:
--file-num=N number of files to create [128]
--file-block-size=N block size to use in all IO operations [16384]
--file-total-size=SIZE total size of files to create [2G]
--file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
--file-io-mode=STRING file operations mode {sync,async,mmap} [sync]
--file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} []
--file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
--file-fsync-all[=on|off] do fsync() after each write operation [off]
--file-fsync-end[=on|off] do fsync() at the end of test [on]
--file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
--file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]
--file-rw-ratio=N reads/writes ratio for combined test [1.5]
2.3 测两把看看
- 先看随机读
[root@VM_42_63_centos sysdata]# sysbench fileio \
> --time=180 \
> --threads=24 \
> --file-total-size=110G \
> --file-test-mode=rndrd \
> --file-num=4 \
> --file-extra-flags=direct \
> --file-fsync-freq=0 \
> --file-block-size=16384 \
> run
sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 24
Initializing random number generator from current time
Extra file open flags: directio
4 files, 2.5GiB each
10GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=1752.15 27.38 MiB/s (28.71 MB/s)
write: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
fsync: IOPS=0.00
Latency (ms):
min: 0.07
avg: 13.70
max: 687.59
95th percentile: 36.89
sum: 4319633.88
- 再看随机写
[root@VM_42_63_centos sysdata]# sysbench fileio \
> --time=180 \
> --threads=24 \
> --file-total-size=110G \
> --file-test-mode=rndwr \
> --file-num=4 \
> --file-extra-flags=direct \
> --file-fsync-freq=0 \
> --file-block-size=16384 \
> run
sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 24
Initializing random number generator from current time
Extra file open flags: directio
4 files, 2.5GiB each
10GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random write test
Initializing worker threads...
Threads started!
Throughput:
read: IOPS=0.00 0.00 MiB/s (0.00 MB/s)
write: IOPS=1094.75 17.11 MiB/s (17.94 MB/s)
fsync: IOPS=0.53
Latency (ms):
min: 0.09
avg: 21.92
max: 3376.77
95th percentile: 94.10
sum: 4319984.68
随机读的iops为1752,随机写的iops为1094,读写非对称
清理测试文件用cleanup选项即可
我们主要看随机写的性能哦
sysbench对MySQL的压测,使用sysbench压测磁盘io的更多相关文章
- 使用sysbench对mysql压力测试
sysbench是一个模块化的.跨平台.多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况.关于这个项目的详细介绍请看:https://github.com/akopytov/sy ...
- 使用sysbench对MySQL进行压力测试
1.背景 出自percona公司,是一款多线程系统压测工具,可以根据影响数据库服务器性能的各种因素来评估系统的性能.例如,可以用来测试文件IO,操作系统调度器,内存分配和传输速度,POSIX线程以及 ...
- MySQL性能压力基准测试工具sysbench
1.sysbench介绍 这里介绍一款MySQL数据库的压力测试软件sysbench,用它来进行基准测试. sysbench 是一个开源的.模块化的.跨平台的多线程性能测试工具, 可以用来进行CPU. ...
- sysbench(mysql测试工具 )
目录 一.基准测试简介 1.什么是基准测试 2.基准测试的作用 3.基准测试的指标 4.基准测试的分类 二.sysbench 1.sysbench简介 2.sysbench安装 3.sysbench语 ...
- 使用 sysbench对mysql进行压力测试介绍之一
sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试.数据库目前支持MySQL/Oracle/PostgreSQL.本文只是简单演示一下几种测试的用 ...
- 利用sysbench进行MySQL OLTP基准测试
Preface In order to know clearly about the real performance threshold of database server,we ...
- 使用sysbench 对mysql进行性能测试
使用sysbench 对mysql进行性能测试 sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有My ...
- ubuntu 18.04使用sysbench测试MySQL性能
首先下载安装sysbench: sudo apt-get install sysbench -y 查看一下sysbench版本是多少: zifeiy@zifeiy-S1-Series:~$ sysbe ...
- Sysbench对Mysql进行基准测试
前言 1.基准测试(benchmarking)是性能测试的一种类型,强调的是对一类测试对象的某些性能指标进行定量的.可复现.可对比的测试. 进一步来理解,基准测试是在某个时候通过基准测试建立一个已知的 ...
随机推荐
- Java开发技术大揭底——让你认知自己技术上的缺陷,成为架构师
一.分布式架构体系 分布式怎么来的.传统的电信.银行业,当业务量大了之后,普通服务器CPU/IO/网络到了100%,请求太慢怎么办?最直接的做法,升级硬件,反正也不缺钱,IBM小型机,大型机,采购了堆 ...
- redis-cluster无备节点,安装脚本
#!/bin/bash #安装gcc yum -y install gcc #安装RVM所需的程序包 yum -y install gcc-c++ patch readline readline-de ...
- 【转】ASP.NET Core MVC 配置全局路由前缀
本文地址:http://www.cnblogs.com/savorboard/p/dontnet-IApplicationModelConvention.html作者博客:Savorboard 前言 ...
- MobaXterm不能读取C:\Windows\system32作为系统变量
OS环境:Win7 pro x64 已勾选:Settings-->Terminal-->勾选Use Windows PATH environment 然后在MobaXterm中查看系统变量 ...
- Code Complete-13/7/29
Measure Twice,Cut Once! 漫步到第三章: just is about upstream prerequisites. 在构建活动开始之前,准备工作要做的周全. Upstream ...
- Kafka实战-Kafka Cluster
1.概述 在<Kafka实战-入门>一篇中,为大家介绍了Kafka的相关背景.原理架构以及一些关键知识点,本篇博客为大家来赘述一下Kafka Cluster的相关内容,下面是今天为大家分享 ...
- CSS 基础:CSS 工作原理(2)<思维导图>
这段时间利用一下间隙时间学习了CSS的基础知识,主要目的是加深对CSS的理解,虽然个人主要工作基本都是后台开发,但是个人觉得系统学习一下CSS的基础还是很有必要的.下面我学习CSS时做的思维导图(全屏 ...
- 图像处理之Retinex增强算法(SSR、MSR、MSRCR)
视网膜-大脑皮层(Retinex)理论认为世界是无色的,人眼看到的世界是光与物质相互作用的结果,也就是说,映射到人眼中的图像和光的长波(R).中波(G).短波(B)以及物体的反射性质有关 其中I是人眼 ...
- asp.net MVC 5 Scaffolding多层架构代码生成向导开源项目(邀请你的参与)
Visual Studio.net 2013 asp.net MVC 5 Scaffolding代码生成向导开源项目 提高开发效率,规范代码编写,最好的方式就是使用简单的设计模式(MVC , Repo ...
- RIP笔记
RIP(工作中没见人用过这种古老的协议,了解一下距离矢量的思想即可) RIPv2支持VLSM但不支持CIDR RIP工作在应用层,用UDP封装,端口是520 无论是RIPv1还是RIPv2都既支持周期 ...