Databases 24 min read

Understanding MySQL InnoDB Buffer Pool: Architecture, Memory Structure, and Management

This article provides a comprehensive overview of MySQL InnoDB's Buffer Pool, explaining its memory layout, data and cache pages, free, flush, and LRU lists, hot‑cold separation, dynamic resizing with chunk mechanisms, and practical configuration tips for production environments.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Understanding MySQL InnoDB Buffer Pool: Architecture, Memory Structure, and Management

Buffer Pool is a critical InnoDB component that stores data pages in memory, allowing MySQL to perform all CRUD operations on cached data rather than directly on disk, dramatically improving performance.

The default size of Buffer Pool is 128 MiB, configurable via innodb_buffer_pool_size . Example commands to view and adjust the size:

# 查看和调整innodb_buffer_pool_size
1. 查看@@innodb_buffer_pool_size大小,单位字节
SELECT @innodb_buffer_pool_size/1024/1024/1024; #字节转为G

2. 在线调整InnoDB缓冲池大小,如果不设置,默认为128M
SET GLOBAL innodb_buffer_pool_size = 4227858432; ##单位字节

Data is loaded into Buffer Pool as data pages (default 16 KiB each). When a row is accessed, MySQL locates the corresponding data page, loads it into a cache page of the same size, and stores metadata describing the page.

Each cache page has an associated description block (≈15 % of the page size) that records the tablespace ID, page number, and other metadata. These description blocks are organized into several linked lists:

Free list : holds description blocks of unused cache pages. When a page is needed, MySQL removes a block from this list.

Flush list : records description blocks of dirty pages (pages modified in memory but not yet written to disk). A background thread periodically writes these pages back and moves their blocks back to the free list.

LRU list : maintains cache pages ordered by recent usage. New pages are inserted at the head of the cold region; frequently accessed pages migrate to the hot region.

The LRU list is further refined by hot‑cold separation. The innodb_old_blocks_pct parameter (default 37 %) defines the proportion of the list considered "cold". Pages accessed after a configurable delay ( innodb_old_blocks_time , default 1000 ms) move from cold to hot. When the pool is full, the tail of the cold region is evicted.

MySQL also uses a hash table mapping tablespace_id + page_number to the cache page address, enabling fast lookup and preventing duplicate caching across multiple Buffer Pool instances.

To address the overhead of pre‑read (read‑ahead) mechanisms, MySQL provides parameters such as innodb_read_ahead_threshold and innodb_random_read_ahead (default OFF) that control when adjacent pages are loaded into the pool.

# 哪些情况会触发预读机制
1. 参数 innodb_read_ahead_threshold 默认 56;顺序访问超过阈值时,线性预读相邻区的所有页。
2. 当 Buffer Pool 中已缓存 13 个连续且频繁访问的页时,随机预读会加载同一区的其余页(由 innodb_random_read_ahead 控制,默认 OFF)。

Dynamic resizing is achieved via the chunk mechanism. Buffer Pool is divided into equal‑sized chunks (default 128 MiB, configurable with innodb_buffer_pool_chunk_size ). Adding or removing chunks changes the pool size without requiring a contiguous memory allocation or data copy.

# 什么是chunk机制
chunk 是 MySQL 将 Buffer Pool 拆分为若干相同大小块的机制,默认每块 128 MiB。比如 2 GiB 的 Buffer Pool 包含 16 个 chunk,每个 chunk 拥有自己的缓存页和描述块,free、flush、LRU 列表在所有 chunk 之间共享。

In production, it is recommended to allocate 50‑60 % of the server RAM to Buffer Pool and to tune related parameters such as innodb_buffer_pool_instances (e.g., 4 instances for an 8 GiB pool) for better concurrency.

# Buffer Pool 的总大小
innodb_buffer_pool_size=8589934592
# Buffer Pool 实例数
innodb_buffer_pool_instance=4

Monitoring can be done with SHOW ENGINE INNODB STATUS , which reports memory allocation, free buffers, LRU length, dirty pages, hit rate, and other vital statistics.

SHOW ENGINE INNODB STATUS;

Overall, understanding Buffer Pool internals—its memory structure, linked‑list management, hot/cold separation, and dynamic chunk resizing—helps DBAs diagnose performance issues and configure MySQL for optimal throughput.

memory managementInnoDBMySQLLRUDatabase Performancebuffer poolChunk
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.