一、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.
AnInnoDBoptimization 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 情况下一次就行了,看图
----