InnoDB Memory Structures: Buffer Pool, Page Management, Change Buffer, Log Buffer, and Adaptive Hash Index
This article explains MySQL InnoDB's internal memory architecture, covering the buffer pool's composition and sizing, page classification and management via free, flush, and LRU lists, the change buffer for secondary index updates, log buffer behavior, and the role of the adaptive hash index.
MySQL InnoDB uses several in‑memory structures—Buffer Pool, Change Buffer, Log Buffer, and Adaptive Hash Index—to reduce disk I/O and improve performance.
The Buffer Pool (default 128 MiB) caches table and index pages; each page (16 KiB) is described by a control block (~5 % of page size) that stores tablespace ID, page number, and its address in the pool.
InnoDB determines whether a page is cached via a hash table keyed by tablespace ID and page number, mapping to the corresponding control block.
Pages are classified as Free, Clean, or Dirty. Their lifecycle is managed by three linked lists: the free list (holds unused pages), the flush list (holds dirty pages awaiting write‑back, ordered by modification time), and the LRU list (orders pages by recent usage).
The free‑list workflow selects a free control block, fills its metadata, and removes it from the list when the page is allocated.
The flush list stores dirty pages that will be flushed to disk; its structure mirrors the free list but tracks modification timestamps.
The ordinary LRU list implements a Least‑Recently‑Used policy: accessed pages are moved to the head, and pages are evicted from the tail. Its advantages are fast access to hot data, while full‑table scans can cause useful pages to be evicted.
An improved LRU splits the list into "new" and "old" sections, inserting newly read pages at the midpoint; pages accessed quickly move toward the new‑list head, otherwise they drift toward the old‑list tail for eventual eviction.
The Change Buffer optimizes writes to secondary (non‑unique) indexes by buffering modifications in memory instead of immediately loading the target pages; it occupies about 25 % (up to 50 %) of the Buffer Pool and merges its contents back to the data pages on read, periodic background merges, or shutdown.
The Log Buffer holds redo/undo log records before they are flushed to the log file; its size and flush behavior are controlled by innodb_log_buffer_size and innodb_flush_log_at_trx_commit (values 0, 1, or 2).
The Adaptive Hash Index builds hash indexes on frequently accessed pages to speed up lookups.
Overall, understanding these structures helps tune InnoDB performance and plan capacity for memory‑intensive workloads.
政采云技术
ZCY Technology Team (Zero), based in Hangzhou, is a growth-oriented team passionate about technology and craftsmanship. With around 500 members, we are building comprehensive engineering, project management, and talent development systems. We are committed to innovation and creating a cloud service ecosystem for government and enterprise procurement. We look forward to your joining us.
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.