本方法来自于阿里云的MySQL性能白皮书,原文地址:https://help.aliyun.com/document_detail/35264.html?spm=a2c4g.11174359.6.771.pUKh2n

但是我在实践过程中发现,一些细节部分由于多出了空格,导致方法并不能使用,曾经提交给阿里云客服但是没有回应。

本篇文章意在给予读者正确的使用方法和所得结果的参数分析。

首先创建测试机(我是在openstack云上做的这些操作,所以是创建了trove的mysql实例,mysql实例作为测试机可以测试mysql和mariadb实例。),然后创建被测试机(mysql或mariadb实例)。我们会由测试机发起测试,以得出被测试机的性能。

在测试机上完成以下操作:

下载sysbench

git clone https://github.com/akopytov/sysbench.git
cd sysbench/

切换到0.5的分支:

git checkout -b fix-EAS- remotes/origin/0.5

更新源(阿里源,用来下载其他的包):

vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
sudo apt-get update

安装需要的包:

sudo apt-get install libmysqlclient-dev
sudo apt-get install automake autoconf automake make libtool bzr

安装sysbench

./autogen.sh
./configure --prefix=/usr --mandir=/usr/share/man
make
make install

至此测试机上的准备工作完成,然后在被测试机上做准备工作(没有前端管理界面的可以自行通过mysql命令行进行创建,这里不再赘述)。

1、通过前端页面在被测试机上创建一个数据库
2、通过前端页面在被测试机上创建一个用户,并且赋予用户对步骤1创建的数据库的权限。

阿里测试方法
1、准备数据(注意修改mysql-host,mysql-user,mysql-password,mysql-db):

sysbench --num-threads= --max-time= --max-requests= --test=oltp.lua --oltp-table-size= --oltp-tables-count= --db-driver=mysql --mysql-table-engine=innodb --mysql-host=192.168.23.128 --mysql-port= --mysql-user=admin --mysql-password= --mysql-db=nova prepare

开始测试压力性能(注意修改mysql-host,mysql-user,mysql-password,mysql-db):

sysbench --num-threads= --max-time= --max-requests= --test=oltp.lua --oltp-table-size= --oltp-tables-count= --db-driver=mysql --mysql-table-engine=innodb --mysql-host=192.168.23.128 --mysql-port= --mysql-user=admin --mysql-password= run

清除数据(注意修改mysql-host,mysql-user,mysql-password,mysql-db):

sysbench --num-threads= --max-time= --max-requests= --test=oltp.lua --oltp-table-size= --oltp-tables-count= --db-driver=mysql --mysql-table-engine=innodb --mysql-host=192.168.111.177 --mysql-port= --mysql-user=admin --mysql-password= --mysql-db=nova cleanup

结果分析:

sysbench 0.5: 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.) – 总事务数(每秒事务数)TPS
deadlocks: 0 (0.00 per sec.) – 发生死锁总数
read/write requests: 1206288 (20103.01 per sec.) – 读写总数(每秒读写次数)QPS
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

https://help.aliyun.com/document_detail/35264.html?spm=a2c4g.11174359.6.771.pUKh2n

mysql与mariadb性能测试方法的更多相关文章

  1. 15 个有用的 MySQL/MariaDB 性能调整和优化技巧(转载的一篇好文)

    MySQL 是一个强大的开源关系数据库管理系统(简称 RDBMS).它发布于 1995 年(20年前).它采用结构化查询语言(SQL),这可能是数据库内容管理中最流行的选择.最新的 MySQL 版本是 ...

  2. 【MySQL】15个有用的MySQL/MariaDB性能调整和优化技巧

    MySQL 是一个强大的开源关系数据库管理系统(简称 RDBMS).它发布于 1995 年(20年前).它采用结构化查询语言(SQL),这可能是数据库内容管理中最流行的选择.最新的 MySQL 版本是 ...

  3. 15 个有用的 MySQL/MariaDB 性能调整和优化技巧

    MySQL 是一个强大的开源关系数据库管理系统(简称 RDBMS).它发布于 1995 年(20年前).它采用结构化查询语言(SQL),这可能是数据库内容管理中最流行的选择.最新的 MySQL 版本是 ...

  4. Navicat(服务器对象) -2之MySQL 或 MariaDB 对象

    MySQL 或 MariaDB 对象 http://www.navicat.com.cn/manual/online_manual/cn/navicat/win_manual/index.html 要 ...

  5. MySQL并发复制系列三:MySQL和MariaDB实现对比

    http://blog.itpub.net/28218939/viewspace-1975856/ 并发复制(Parallel Replication) 系列三:MySQL 5.7 和MariaDB ...

  6. MySQL与MariaDB核心特性比较详细版v1.0(覆盖mysql 8.0/mariadb 10.3,包括优化、功能及维护)

    注:本文严禁任何形式的转载,原文使用word编写,为了大家阅读方便,提供pdf版下载. MySQL与MariaDB主要特性比较详细版v1.0(不含HA).pdf 链接:https://pan.baid ...

  7. CentOS 7 安装 WordPress,PHP,Nginx,MySQL(MariaDB),FTP

    主要资料参考:https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-st ...

  8. MySQL(MariaDB)的 SSL 加密复制

    背景: 在默认的主从复制过程或远程连接到MySQL/MariaDB所有的链接通信中的数据都是明文的,在局域网内连接倒问题不大:要是在外网里访问数据或则复制,则安全隐患会被放大很多.由于项目要求需要直接 ...

  9. numa对MySQL多实例性能影响

     numa对MySQL多实例性能影响,通过对numa将MySQL绑定在不同的CPU节点上,并且采用绑定的内存分配策略,强制在本节点内分配内存.具体测试如下:1.关闭numa(numa= interle ...

随机推荐

  1. Day2-G-Sticks-POJ1011

    George took sticks of the same length and cut them randomly until all parts became at most 50 units ...

  2. Day2-F-A Knight's Journey POJ-2488

    Background The knight is getting bored of seeing the same black and white squares again and again an ...

  3. 102、Java中String类之相等判断(忽略大小写)

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  4. 图的Prim,Kruskal,Dijkstra,Floyd算法

    代码部分有点问题,具体算法没问题, 最近期末考,要过段时间才会修改 //邻接矩阵,具体情况看上一篇的图的实现template<class T>class MGraph {public:   ...

  5. Struts2出现的问题:

    HTTP 500: 在用通配符配置Method时候,action的形式固定,比如customer_*,那么只用一个Action类比如CustomerAction即可. 在配置的时候,不同的方法在同一个 ...

  6. NO23 Linux正则表达式结合三剑客企业级实践--取IP

    企业实践: 一.取IP的方法(用三剑客): grep: awk: sed:虽有三种,但是思路是一样的,用到正则有些表达细节不一样而已. 分析: sed***: 课堂试题: |sed -nr 's#^. ...

  7. activity标题栏和状态栏操作

    修改显示的标题 1.修改AndroidMainfest.xml文件的label标签 2.setTitle("标签"); 去掉标签的显示 1.android:theme=" ...

  8. 微信小程序—显示当前时间

    问题:  在页面上显示当前时间(日期) 方法: 1.在util.js (创建项目自动生成)中: // util.js const formatTime = date => { const yea ...

  9. 将xml字符串的所有叶标签转换成Map集合

    实际问题:对方服务器接口采用webservice方式返回xml报文,现需解析xml获取所有叶节点的标签名及携带的值 解决方案:利用dom4j解析xml并利用递归获取叶节点,将标签名及标签值封装到Map ...

  10. 002.Delphi插件之QPlugins,菜单插件

    运行之后的效果如下, 图一 图二 主界面代码如下 unit Frm_Main; interface uses Winapi.Windows, Winapi.Messages, System.SysUt ...