The log buffer is the memory area that holds data to be written to the log files on disk. Log buffer size is defined by the innodb_log_buffer_size variable. The default size is 16MB. The contents of the log buffer are periodically flushed to disk. A large log buffer enables large transactions to run without the need to write redo log data to disk before the transactions commit. Thus, if you have transactions that update, insert, or delete many rows, increasing the size of the log buffer saves disk I/O.

Log Buffer是内存中不同于Buffer Pool 的一部分会缓存将写入到磁盘中的数据。 Log Buffer的大小可用innodb_log_buffer_size 参数设置。 默认大小是16MB。 Log Buffer 的内容会周期性的刷新到磁盘。 大的Log Buffer 能够包容大的事务无需将数据写入到redo 日志,缩小与磁盘的交互。 事务中如果有大量的dml 操作,能够思考增大Log Buffer的值,缩小磁盘IO。

The innodb_flush_log_at_trx_commit variable controls how the www.cungun.comcontents of the log buffer are written and flushed to disk. The innodb_flush_log_at_timeout variable controls log flushing frequency.

innodb_flush_log_at_trx_commit 参数可能管制 log buffer 写入和刷新到页游磁盘。

innodb_flush_log_at_timeout 参数能管制刷新的频率。

For related information, see Memory Configuration, and Section 8.5.4, “Optimizing InnoDB Redo Logging”.