Understanding InnoDB Buffers: Buffer Pool, Change Buffer, Log Buffer, and Doublewrite Buffer
This article explains MySQL InnoDB's various buffers—including the buffer pool, change buffer, log buffer, and doublewrite buffer—detailing their purposes, internal mechanisms such as LRU variants, configuration options, and how they improve performance and ensure data integrity.
MySQL InnoDB uses several buffers to reduce disk I/O and protect data integrity.
Buffer Pool is an in‑memory cache for table and index pages. It stores pages (default 16 KB) and uses a modified LRU algorithm that separates pages into an old sublist (≈3/8) and a new sublist, with a 1‑second window to avoid evicting hot pages during large scans.
Change Buffer records modifications to secondary index pages that are not currently in the buffer pool, allowing the changes to be applied later when the page is loaded, thus avoiding costly random I/O. It works only for non‑unique secondary indexes.
Log Buffer buffers redo‑log records before they are flushed to the redo‑log file. It batches writes, reducing system‑call overhead, and is flushed based on transaction commit, buffer size, or a periodic 1‑second background thread, controlled by innodb_flush_log_at_trx_commit .
Doublewrite Buffer protects against partial page writes. InnoDB first copies a page to the doublewrite buffer and writes it sequentially to disk; the page is then written to its final location. If a crash occurs, the doublewrite files can be used to recover corrupted pages.
The article also notes configuration considerations, such as the size of the buffer pool, the innodb_old_blocks_pct parameter, and when to disable the change buffer if the workload or hardware makes it unnecessary.
References: MySQL 8.0 InnoDB Storage Engine documentation.
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.