Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MYSQL-12: Improve MySQL memory allocation, especially under NUMA
The problem is that InnoDB buffer pool memory allocations do not follow NUMA policies strictly because pages are lazy-allocated by the OS, and the NUMA policy applies at the time of lazy-allocation rather than the time of reservation. This might lead to out of memory conditions at lazy-allocation time whenever there is memory pressure. A more robust and predictable page allocation model is necessary to mitigate this problem. One strategy to mitigate this problem is to force the OS to pre-allocate the page frames in physical memory required for the buffer pool memory region. To this end, this change implements a new --innodb-buffer-pool-populate option that toggles the preallocation of physical memory for the buffer pool. The preallocation strategy is implemented by using mmap's MAP_POPULATE flag when allocating buffer pool memory, or by pre-faulting the pages if the former does not work.
- Loading branch information
Davi Arnaut
committed
Nov 8, 2011
1 parent
b7d70c2
commit 76e7059
Showing
12 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CALL mtr.add_suppression(".* Forcing preallocation by faulting in pages."); | ||
SELECT @@GLOBAL.innodb_buffer_pool_populate; | ||
@@GLOBAL.innodb_buffer_pool_populate | ||
1 | ||
1 Expected | ||
SET @@GLOBAL.innodb_buffer_pool_populate=0; | ||
ERROR HY000: Variable 'innodb_buffer_pool_populate' is a read only variable | ||
Expected error 'Read only variable' | ||
SELECT @@GLOBAL.innodb_buffer_pool_populate; | ||
@@GLOBAL.innodb_buffer_pool_populate | ||
1 | ||
1 Expected |
1 change: 1 addition & 0 deletions
1
mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic-master.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--innodb-buffer-pool-populate=true |
16 changes: 16 additions & 0 deletions
16
mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--source include/have_innodb.inc | ||
|
||
CALL mtr.add_suppression(".* Forcing preallocation by faulting in pages."); | ||
|
||
# Display current value of innodb_use_sys_malloc | ||
SELECT @@GLOBAL.innodb_buffer_pool_populate; | ||
--echo 1 Expected | ||
|
||
# Variable should be read-only | ||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SET @@GLOBAL.innodb_buffer_pool_populate=0; | ||
--echo Expected error 'Read only variable' | ||
|
||
SELECT @@GLOBAL.innodb_buffer_pool_populate; | ||
--echo 1 Expected | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters