How InnoDB flush the log buffer

When InnoDB flush the log buffer to the log file on disk, it locks the buffer with a mutex, flushes up it to a desired point, and then moves any remaining entries to the front of the buffer.

If you care more about performance than durability, you can change innodb_flush_log_at_trx_commit to control where and how often the log buffer is flushed.

0: write the log buffer to the log file and flush the log file every second, and do nothing at transaction commit.

1:write the log buffer to the log file and flush it to durable storage every time a transaction commits.

2: write the log buffer to the log file at every commit, but do not flush it.

In most operating systems, writing the buffer to the log simply moves the data from InnoDB’s memory buffer to the operating system’s cache, which is also in memory.

In contrast, flushing the log to durable storage means InnoDB asks the operating system to flush the data out of the cache and ensure it is written to the disk.

Sometime the disk controller or operating system can fask flush by put the data to yet another cache.

Setting innodb_flush_log_at_trx_commit anything other than 1 can cause you to lose transactions.

the best configuration for high performance transactional needs is to leave innodb_flush_log_at_trx_commit set to 1 and place the log files on a raid volumn backed by a battery backed cache.

PErconer Server extends … to make is a per-session variable, instead of global for a whole server.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值