本方法来自于阿里云的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. logj4.xml

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration PU ...

  2. AJAX的兼容处理方式

    AJAX在网站服务中使用到频率很高,也需要考虑各个浏览器版本的兼容性,本示例中详细介绍简单快捷的处理兼容性问题. <!DOCTYPE HTML> <html> <head ...

  3. mac flutter 创建过程及遇到的问题

    参考: 1.入门: 在macOS上搭建Flutter开发环境 系统要求 2.mac配置环境变量 1.打开终端 2.clone flutter 命令: git clone -b beta https:/ ...

  4. 使用Ghidra分析phpStudy后门

    一.工具和平台 主要工具: Kali Linux Ghidra 9.0.4 010Editor 9.0.2 样本环境: Windows7 phpStudy 20180211 二 .分析过程 先在 Wi ...

  5. python基础学习(一)

    一,Python介绍 1,python的出生与应用 python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆(中文名字:龟叔)为了在阿姆斯特丹打 ...

  6. Selenium -- ActionChains().move_by_offset() 卡顿的解决方法

    测试运行时间 运行时间 发现每次0.5秒,此时需要修改默认的时间 打开Python安装目录下的Lib\site-packages\selenium\webdriver\common\actions\p ...

  7. bean的autowire属性及其生命周期

    一:sutowire属性 1.no:默认值,禁用自动装配: 2.byName:根据属性名称自动装配: 3.byType:根据属性类型自动装配: 4.constructor:通过构造方法自动装配,不推荐 ...

  8. Codeforces Round #622 (Div. 2) 题解和我的分析

    首先下午场非常适合中国人,开心 A 三种食物有个数限制,上菜,每次上菜跟以前的样式不能一样(食物的种类及个数各不相同),且每种食物最多用一次,问最多能上几次 对a,b,c排序,然后枚举上菜种类就可以了 ...

  9. Arch系Linux中安装Docker

    Arch系Linux中安装Docker 1. 下载最新版docker $ sudo pacman -Syu docker 2. 免sudo执行docker $ sudo gpasswd -a ${US ...

  10. HTML学习第二天

    HTML学习第二天 今天学的比较少,有些乱,先只写一个知识点 三种样式表插入方式 外部样式表: <link rel="stylesheet" type="text/ ...