RDS MySQL 5.7 4核和8核共享规格性能压测

简介: 写在前面 这次压测只用了一台ECS,也没有调整各种压测比和压测参数,把实例压到最高;这里的压测只是为了说明不同的参数对性能影响,要想得出一个结论,必须要在可对比的情况下,比如:实例规格一样,从压测机到被压测机网络延迟一样,MySQL的配置文件一样等等,否则都是耍流氓。

写在前面

这次压测只用了一台ECS,也没有调整各种压测比和压测参数,把实例压到最高;这里的压测只是为了说明不同的参数对性能影响,要想得出一个结论,必须要在可对比的情况下,比如:实例规格一样,从压测机到被压测机网络延迟一样,MySQL的配置文件一样等等,否则都是耍流氓。

压测环境

被压测的RDS实例规格

MySQL 5.7 物理机版 新规格8核32G 
MySQL 5.7 物理机版 新规格4核16G

RDS主要参数配置

MySQL [(none)]> SHOW global VARIABLES WHERE Variable_name in ("sync_binlog","innodb_flush_log_at_trx_commit","rpl_semi_sync_slave_enabled","rpl_semi_sync_master_enabled","query_cache_type","have_query_cache");
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| have_query_cache               | YES   |
| innodb_flush_log_at_trx_commit | 1|2     |
| query_cache_type               | OFF   |
| rpl_semi_sync_master_enabled   | ON|OFF    |
| rpl_semi_sync_slave_enabled    | OFF   |
| sync_binlog                    | 1|1000     |
+--------------------------------+-------+

关于参数

innodb_flush_log_at_trx_commit的作用可以参考:
MySQL · 参数故事 · innodb_flush_log_at_trx_commit
sync_binlog的作用可以参考:
MySQL · 答疑解惑 · binlog 位点刷新策略
MySQL · 引擎特性 · InnoDB 事务子系统介绍
半同步的作用可以参考:
MySQL · 源码分析 · MySQL BINLOG半同步复制数据安全性分析
MySQL · 源码分析 · MySQL 半同步复制数据一致性分析

网络延迟

从压测机ping RDS

64 bytes from *** (***): icmp_seq=1 ttl=64 time=1.69 ms
64 bytes from *** (***): icmp_seq=2 ttl=64 time=1.72 ms
64 bytes from *** (***): icmp_seq=3 ttl=64 time=1.72 ms
64 bytes from *** (***): icmp_seq=4 ttl=64 time=1.73 ms
64 bytes from *** (***): icmp_seq=5 ttl=64 time=1.73 ms
64 bytes from *** (***): icmp_seq=6 ttl=64 time=1.72 ms
64 bytes from *** (***): icmp_seq=7 ttl=64 time=1.73 ms
64 bytes from *** (***): icmp_seq=8 ttl=64 time=1.73 ms
64 bytes from *** (***): icmp_seq=9 ttl=64 time=1.72 ms

压测方法

sysbench /usr/share/sysbench/*** \
--mysql-host=*** \
--mysql-port=3306 \
--mysql-user=*** \
--mysql-password='***' \
--mysql-db=*** \
--db-driver=mysql \
--tables=10 \
--table-size=1000000 \
--report-interval=10 \
--threads=128 \
--time=120 prepare/run/cleanup

压测结果

8核32G 读写场景

双1

MySQL [(none)]> SHOW global VARIABLES WHERE Variable_name in ("sync_binlog","innodb_flush_log_at_trx_commit","rpl_semi_sync_slave_enabled","rpl_semi_sync_master_enabled","query_cache_type","have_query_cache");
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| have_query_cache               | YES   |
| innodb_flush_log_at_trx_commit | 1     |
| query_cache_type               | OFF   |
| rpl_semi_sync_master_enabled   | ON    |
| rpl_semi_sync_slave_enabled    | OFF   |
| sync_binlog                    | 1     |
+--------------------------------+-------+
6 rows in set (0.00 sec)

oltp_read_write.lua
SQL statistics:
    transactions:                        262843 (2187.92 per sec.)
    queries:                             5256860 (43758.44 per sec.)
General statistics:
    total time:                          120.1320s
    total number of events:              262843

Latency (ms):
         min:                                 20.91
         avg:                                 58.45
         max:                                339.70
         95th percentile:                     86.00
         sum:                            15361894.55

# mysqlslap -a --concurrency=128 --number-of-queries 10000 --iterations=5 --engine=innodb --debug-info -u*** -p*** -h*** -P3306 --create-schema=***
Benchmark
    Running for engine innodb
    Average number of seconds to run all queries: 11.504 seconds
    Minimum number of seconds to run all queries: 9.150 seconds
    Maximum number of seconds to run all queries: 16.737 seconds
    Number of clients running queries: 128
    Average number of queries per client: 78           

sync_binlog:1000和trx_commit=2

MySQL [(none)]> SHOW global VARIABLES WHERE Variable_name in ("sync_binlog","innodb_flush_log_at_trx_commit","rpl_semi_sync_slave_enabled","rpl_semi_sync_master_enabled","query_cache_type","have_query_cache");
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| have_query_cache               | YES   |
| innodb_flush_log_at_trx_commit | 2     |
| query_cache_type               | OFF   |
| rpl_semi_sync_master_enabled   | OFF   |
| rpl_semi_sync_slave_enabled    | OFF   |
| sync_binlog                    | 1000     |
+--------------------------------+-------+
6 rows in set (0.00 sec)
Threads started!

#oltp_read_write.lua
SQL statistics:
    queries performed:
        read:                            3809666
        write:                           1088476
        other:                           544238
        total:                           5442380
    transactions:                        272119 (2266.76 per sec.)
    queries:                             5442380 (45335.11 per sec.)
General statistics:
    total time:                          120.0462s
    total number of events:              272119

Latency (ms):
         min:                                 20.08
         avg:                                 56.45
         max:                                339.44
         95th percentile:                     84.47
         sum:                            15361371.70
# mysqlslap -a --concurrency=128 --number-of-queries 10000 --iterations=5 --engine=innodb --debug-info -u*** -p*** -h*** -P*** --create-schema=***
Benchmark
    Running for engine innodb
    Average number of seconds to run all queries: 9.238 seconds
    Minimum number of seconds to run all queries: 8.394 seconds
    Maximum number of seconds to run all queries: 9.624 seconds
    Number of clients running queries: 128
    Average number of queries per client: 78            

只读场景

#oltp_point_select.lua
SQL statistics:
    queries performed:
        read:                            11432749
        write:                           0
        other:                           0
        total:                           11432749
    transactions:                        11432749 (95255.06 per sec.)
    queries:                             11432749 (95255.06 per sec.)
General statistics:
    total time:                          120.0208s
    total number of events:              11432749

Latency (ms):
         min:                                  0.90
         avg:                                  1.34
         max:                                 18.23
         95th percentile:                      1.79
         sum:                            15351945.95    

4核16G读写场景

双1

MySQL [(none)]> SHOW global VARIABLES WHERE Variable_name in ("sync_binlog","innodb_flush_log_at_trx_commit","rpl_semi_sync_slave_enabled","rpl_semi_sync_master_enabled","query_cache_type","have_query_cache");
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| have_query_cache               | YES   |
| innodb_flush_log_at_trx_commit | 1     |
| query_cache_type               | OFF   |
| rpl_semi_sync_master_enabled   | ON    |
| rpl_semi_sync_slave_enabled    | OFF   |
| sync_binlog                    | 1     |
+--------------------------------+-------+

oltp_read_write.lua
SQL statistics:
    queries performed:
        read:                            1643950
        write:                           469700
        other:                           234850
        total:                           2348500
    transactions:                        117425 (977.46 per sec.)
    queries:                             2348500 (19549.17 per sec.)
General statistics:
    total time:                          120.1314s
    total number of events:              117425

Latency (ms):
         min:                                 28.19
         avg:                                130.88
         max:                                446.28
         95th percentile:                    155.80
         sum:                            15368416.16

# mysqlslap -a --concurrency=128 --number-of-queries 10000 --iterations=5 --engine=innodb --debug-info -u*** -p*** -h*** -P3306 --create-schema=***
Benchmark
    Running for engine innodb
    Average number of seconds to run all queries: 12.546 seconds
    Minimum number of seconds to run all queries: 12.445 seconds
    Maximum number of seconds to run all queries: 12.657 seconds
    Number of clients running queries: 128
    Average number of queries per client: 78            

sync_binlog:1000和trx_commit=2

mysql> SHOW global VARIABLES WHERE Variable_name in ("sync_binlog","innodb_flush_log_at_trx_commit","rpl_semi_sync_slave_enabled","rpl_semi_sync_master_enabled","query_cache_type","have_query_cache");
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| have_query_cache               | YES   |
| innodb_flush_log_at_trx_commit | 2     |
| query_cache_type               | OFF   |
| rpl_semi_sync_master_enabled   | OFF   |
| rpl_semi_sync_slave_enabled    | OFF   |
| sync_binlog                    | 1000  |
+--------------------------------+-------+

oltp_read_write.lua
SQL statistics:
    queries performed:
        read:                            1650866
        write:                           471676
        other:                           235838
        total:                           2358380
    transactions:                        117919 (981.66 per sec.)
    queries:                             2358380 (19633.27 per sec.)
General statistics:
    total time:                          120.1198s
    total number of events:              117919

Latency (ms):
         min:                                 21.31
         avg:                                130.32
         max:                                439.36
         95th percentile:                    155.80
         sum:                            15366638.87    

只读场景

oltp_point_select.lua
SQL statistics:
    queries performed:
        read:                            4924841
        write:                           0
        other:                           0
        total:                           4924841
    transactions:                        4924841 (41031.29 per sec.)
    queries:                             4924841 (41031.29 per sec.)

General statistics:
    total time:                          120.0248s
    total number of events:              4924841

Latency (ms):
         min:                                  0.90
         avg:                                  3.12
         max:                                 65.22
         95th percentile:                     28.16
         sum:                            15356974.94    

性能对比图

oltp_rw
oltp_point_select

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
缓存 关系型数据库 BI
使用MYSQL Report分析数据库性能(下)
使用MYSQL Report分析数据库性能
813 158
|
负载均衡 算法 关系型数据库
大数据大厂之MySQL数据库课程设计:揭秘MySQL集群架构负载均衡核心算法:从理论到Java代码实战,让你的数据库性能飙升!
本文聚焦 MySQL 集群架构中的负载均衡算法,阐述其重要性。详细介绍轮询、加权轮询、最少连接、加权最少连接、随机、源地址哈希等常用算法,分析各自优缺点及适用场景。并提供 Java 语言代码实现示例,助力直观理解。文章结构清晰,语言通俗易懂,对理解和应用负载均衡算法具有实用价值和参考价值。
大数据大厂之MySQL数据库课程设计:揭秘MySQL集群架构负载均衡核心算法:从理论到Java代码实战,让你的数据库性能飙升!
|
关系型数据库 MySQL 数据库
阿里云数据库RDS费用价格:MySQL、SQL Server、PostgreSQL和MariaDB引擎收费标准
阿里云RDS数据库支持MySQL、SQL Server、PostgreSQL、MariaDB,多种引擎优惠上线!MySQL倚天版88元/年,SQL Server 2核4G仅299元/年,PostgreSQL 227元/年起。高可用、可弹性伸缩,安全稳定。详情见官网活动页。
2116 152
|
关系型数据库 MySQL 数据库
阿里云数据库RDS支持MySQL、SQL Server、PostgreSQL和MariaDB引擎
阿里云数据库RDS支持MySQL、SQL Server、PostgreSQL和MariaDB引擎,提供高性价比、稳定安全的云数据库服务,适用于多种行业与业务场景。
1442 156
|
缓存 监控 关系型数据库
使用MYSQL Report分析数据库性能(中)
使用MYSQL Report分析数据库性能
934 156
|
缓存 监控 关系型数据库
使用MYSQL Report分析数据库性能(上)
最终建议:当前系统是完美的读密集型负载模型,优化重点应放在减少行读取量和提高数据定位效率。通过索引优化、分区策略和内存缓存,预期可降低30%的CPU负载,同时保持100%的缓冲池命中率。建议每百万次查询后刷新统计信息以持续优化
961 161
|
存储 SQL 关系型数据库
RDS DuckDB技术解析一:当 MySQL遇见列式存储引擎
RDS MySQL DuckDB分析实例以​列式存储与向量化计算​为核心,实现​复杂分析查询性能百倍跃升​,为企业在海量数据规模场景下提供​实时分析能力​,加速企业数据驱动型决策效能。​​
|
关系型数据库 分布式数据库 数据库
阿里云数据库收费价格:MySQL、PostgreSQL、SQL Server和MariaDB引擎费用整理
阿里云数据库提供多种类型,包括关系型与NoSQL,主流如PolarDB、RDS MySQL/PostgreSQL、Redis等。价格低至21元/月起,支持按需付费与优惠套餐,适用于各类应用场景。
|
SQL 关系型数据库 MySQL
Mysql数据恢复—Mysql数据库delete删除后数据恢复案例
本地服务器,操作系统为windows server。服务器上部署mysql单实例,innodb引擎,独立表空间。未进行数据库备份,未开启binlog。 人为误操作使用Delete命令删除数据时未添加where子句,导致全表数据被删除。删除后未对该表进行任何操作。需要恢复误删除的数据。 在本案例中的mysql数据库未进行备份,也未开启binlog日志,无法直接还原数据库。
1173 2
|
关系型数据库 MySQL 分布式数据库
Super MySQL|揭秘PolarDB全异步执行架构,高并发场景性能利器
阿里云瑶池旗下的云原生数据库PolarDB MySQL版设计了基于协程的全异步执行架构,实现鉴权、事务提交、锁等待等核心逻辑的异步化执行,这是业界首个真正意义上实现全异步执行架构的MySQL数据库产品,显著提升了PolarDB MySQL的高并发处理能力,其中通用写入性能提升超过70%,长尾延迟降低60%以上。

推荐镜像

更多