MariaDB Enterprise Server Configure the InnoDB Buffer Pool
This page is part of MariaDB's Documentation.
The parent of this page is: MariaDB Enterprise Server InnoDB Operations
Topics on this page:
Overview
In MariaDB Enterprise Server, the InnoDB storage engine uses the Buffer Pool as an in-memory cache. The Buffer Pool caches pages that were recently accessed. If a lot of pages are being accessed sequentially, the Buffer Pool also preemptively caches nearby pages. Pages are evicted using a least recently used (LRU) algorithm.
The contents of the Buffer Pool can be reloaded at startup, so that InnoDB does not have to function with a "cold" cache after a restart. To support this, the page numbers of all pages in the Buffer Pool can be dumped at shutdown. During startup, the page numbers are read from the dump, and InnoDB uses the page numbers to reload each page from its corresponding data file.
The size of each page in the Buffer Pool depends on the value of the innodb_
In versions up to MariaDB Enterprise Server 10.4 and MariaDB Community Server 10.4, the Buffer Pool is divided into multiple instances. The number of instances is configured by the innodb_
For additional information, see "InnoDB Buffer Pool".
This page describes how to configure the InnoDB Buffer Pool.
Configure the InnoDB Buffer Pool Size
The size of the InnoDB Buffer Pool can be configured by setting the innodb_
Available Memory | Recommended InnoDB Buffer Pool Size |
---|---|
4 GB | 2 GB |
8 GB | 4-8 GB |
16 GB | 8-12 GB |
32 GB | 16-24 GB |
64 GB | 32-56 GB |
128 GB | 64-96 GB |
256 GB | 128-192 GB |
The method to configure the Buffer Pool size depends on whether a server restart will be performed:
Product Versions | Server Restart? | Method |
---|---|---|
Any ES
Any CS
| No | |
Any ES
Any CS
| Yes |
Configure the InnoDB Buffer Pool Size with SET GLOBAL
The size of the InnoDB buffer pool can be changed dynamically by setting the innodb_SUPER
privilege.
To ensure that the change survives server restarts, the innodb_
To configure the InnoDB Buffer Pool with the SET GLOBAL statement, use the following procedure:
Connect to the server using MariaDB Client as the
root@localhost
user account or another user account with theSUPER
privilege:$ mariadb --user=root
Set the innodb_
buffer_ system variable to the new size using the SET GLOBAL statement.pool_ size For example, to set the size to 2 GB:
SET GLOBAL innodb_buffer_pool_size=(2 * 1024 * 1024 * 1024);
Confirm that the resize operation has been completed by querying the Innodb_
buffer_ status variable using the SHOW GLOBAL STATUS statement:pool_ resize_ status SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_resize_status';
+----------------------------------+----------------------------------------------------+ | Variable_name | Value | +----------------------------------+----------------------------------------------------+ | Innodb_buffer_pool_resize_status | Completed resizing buffer pool at 200904 17:49:48. | +----------------------------------+----------------------------------------------------+
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes will be read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the
z-
prefix in the file name.Some example configuration file paths for different distributions are shown in the following table:
Distributions
Example configuration file path
CentOSRHELRocky LinuxSLES/etc/my.cnf.d/z-custom-mariadb.cnf
DebianUbuntu/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_
buffer_ system variable in the configuration file.pool_ size It needs to be set in a group that will be read by MariaDB Server, such as
[mariadb]
or[server]
.When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 2 GB:
[mariadb] ... innodb_buffer_pool_size=2G
Configure the InnoDB Buffer Pool Size in a Configuration File
The size of the InnoDB Buffer Pool can be changed by setting the innodb_
To configure the InnoDB Buffer Pool in a configuration file, use the following procedure:
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes will be read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the
z-
prefix in the file name.Some example configuration file paths for different distributions are shown in the following table:
Distributions
Example configuration file path
CentOSRHELRocky LinuxSLES/etc/my.cnf.d/z-custom-mariadb.cnf
DebianUbuntu/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_
buffer_ system variable in the configuration file.pool_ size It needs to be set in a group that will be read by MariaDB Server, such as
[mariadb]
or[server]
.When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 2 GB:
[mariadb] ... innodb_buffer_pool_size=2G
Restart the server:
$ sudo systemctl restart mariadb
The server can use the configuration change without a restart if you use SET GLOBAL.