将你的 日志文件 设置得非常大,可能会在 检查点 时减少磁盘 I/O。通常,将日志文件的总大小设置得与缓冲池一样大甚至更大是合理的。Making your log files very large may reduce disk I/O during checkpointing. It often makes sense to set the total size of the log files as large as the buffer pool or even larger.
检查点处理的工作原理How Checkpoint Processing Works
InnoDB 实现了一种称为 检查点 的机制,称为 模糊检查点。InnoDB 以小批量将缓冲池中被修改的数据库页面刷新出去。无需一次性刷新整个缓冲池,这样可以在检查点过程中不中断用户 SQL 语句的处理。InnoDB implements a
checkpoint mechanism known
as fuzzy
checkpointing. InnoDB flushes modified
database pages from the buffer pool in small batches. There is no
need to flush the buffer pool in one single batch, which would
disrupt processing of user SQL statements during the checkpointing
process.
在崩溃恢复期间,InnoDB会查找写入日志文件的检查点标签。它知道标签之前的所有数据库修改都已存在于数据库的磁盘镜像中。然后InnoDB从检查点向前扫描日志文件,将记录的修改应用到数据库中。During crash recovery,
InnoDB looks for a checkpoint label written to
the log files. It knows that all modifications to the database
before the label are present in the disk image of the database.
Then InnoDB scans the log files forward from
the checkpoint, applying the logged modifications to the database.