mysql group commit_mysql-5.7 group commit 详解

一、mysql group commit 的官方定义:

InnoDB, like any other ACID-compliant database engine, flushes the redo log of a transaction before it is committed. InnoDB uses group commit functionality to group multiple such flush requests together to avoid one flush for each commit. With group commit, InnoDB issues a single write to the log file to perform the commit action for multiple user transactions that commit at about the same time, significantly improving throughput.

An InnoDB optimization that performs some low-level I/O operations (log write) once for a set of commit operations, rather than flushing and syncing separately for each commit.

参考连接:

https://dev.mysql.com/doc/refman/5.7/en/innodb-performance-group_commit.html

https://dev.mysql.com/doc/refman/5.7/en/glossary.html#glos_group_commit

二、翻译一下

innodb 和所有支持acid属性的引擎一样,提交得以完成的条件是事务相关的redo log 都刷新到了磁盘,innodb 使用组提交

的方式把多个刷新操作组织到一起,这样就避免为每一个commit发起一个刷新操作,而是多个commit共用一个刷新。

三、group commit 的原理:

为了说明innodb group commit的原理,我在这里假设一个有3个事务同时运行

a事务从t0 时刻开始运行,到t1时刻完成的操作,t9的时间收到了commit指令

b事务从t1 时刻开始运行,到t2时刻完成的操作,t8的时间收到了commit指令

c事务从t3 时刻开始运行,到t4时刻完成的操作,t5的时间收到了commit指令

传统模式下三个commit对应三次刷新操作,但是在group commit 情况下一次就行了,看图

----

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值