mysql innodb_log_buffer_size_MySQL - innodb - How to size innodb_log_buffer_size

Discussion

The MySQL InnoDB log buffer allows transactions to run without having to write the log to disk before the transactions commit. The size of this buffer is configured with the innodb_log_buffer_size variable.

Sensible values range from 1 MB to 8 MB. The default is 1 MB. The minimum value is 256 kB. A setting of 8M is often big enough for most database needs, but some setups with 20 to 30 MB have been seen.

A large log buffer allows large transactions to run without a need to write the log to disk before the transactions commit. Thus, if you have big transactions, making the log buffer larger saves disk I/O.

The innodb_log_buffer_size can be determined with the following command:SHOW GLOBAL VARIABLES

LIKE 'innodb_log_buffer_size';

+------------------------+---------+

| Variable_name | Value |

+------------------------+---------+

| innodb_log_buffer_size | 1048576 |

+------------------------+---------+

Since MySQL 5.0 there is a status called Innodb_log_waits. This status shows the number of times that the log buffer was too small. A wait is required for it to be flushed before continuing.SHOW GLOBAL STATUS

LIKE 'innodb_log_waits';

+------------------+-------+

| Variable_name | Value |

+------------------+-------+

| Innodb_log_waits | 0 |

+------------------+-------+

If this value is 0 or near innodb_log_buffer_size is defined well. If it is high and continuously growing, increase it or reduce the size of your transactions.

A rough estimate of the transaction size can be found on a system

by running the command below before and after the transaction. This gives you a rough feeling about the size.

But keep in mind that on the production system you have concurrency. And your transaction could run the same time several times.SHOW GLOBAL STATUS

LIKE 'innodb_os_log_written';

+-----------------------+---------+

| Variable_name | Value |

+-----------------------+---------+

| Innodb_os_log_written | 4423680 |

+-----------------------+---------+

Please see the external resources links in the margin for more information.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值