Log Buffer有什么用处?


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”.

阅读 206
1 声望
1 粉丝
0 条评论

1 声望
1 粉丝