Buffer Pool
InnoDB
caches table and index data as it is accessed. The buffer pool permits frequently used data to be accessed directly from memory, which speeds up processing. On dedicated servers, up to 80% of physical memory is often assigned to the buffer pool.Buffer Pool LRU Algorithm
The buffer pool is managed as a list using a variation of the LRU algorithm. When room is needed to add a new page to the buffer pool, the least recently used page is evicted and a new page is added to the middle of the list. This midpoint insertion strategy treats the list as two sub-lists:
At the head, a sub-list of new (“young”) pages that were accessed recently
At the tail, a sub-list of old pages that were accessed less recently
The algorithm keeps frequently used pages in the new sub-list. The old sub-list contains less frequently used pages; these pages are candidates for eviction.
By default, the algorithm operates as follows:
3/8 (37%) of the buffer pool is devoted to the old sub-list.
The midpoint of the list is the boundary where the tail of the new sub-list meets the head of the old sub-list.
When
InnoDB
reads a page into the buffer pool, it initially inserts it at the midpoint (the head of the old sub-list). A page can be read because it is required for a user-initiated operation such as an SQL query, or as part of a read-ahead operation performed automatically byInnoDB
.Accessing a page in the old sub-list makes it “young”, moving it to the head of the new sub-list.
As the database operates, pages in the buffer pool that are not accessed “age” by moving toward the tail of the list.
Monitoring the Buffer Pool Using the InnoDB Standard Monitor
InnoDB
Standard Monitor output, which can be accessed using SHOW ENGINE INNODB STATUS
, provides metrics regarding operation of the buffer pool. Buffer pool metrics are located in the BUFFER POOL AND MEMORY
section of InnoDB
Standard Monitor output:
No comments:
Post a Comment
If you have any doubt or question, please contact us.