MariaDB Enterprise Server Configure the InnoDB I/O Threads
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 versions up to MariaDB Enterprise Server 10.4 and MariaDB Community Server 10.4, InnoDB uses the InnoDB I/O Threads to handle completion of I/O requests in the background. The InnoDB Read I/O Threads handle completion of read I/O requests, and the InnoDB Write I/O Threads handle completion of write I/O requests.
Starting with MariaDB Enterprise Server 10.5 and MariaDB Community Server 10.5, the InnoDB I/O Threads were replaced by the asynchronous I/O functionality in the InnoDB Background Thread Pool.
For additional information, see "InnoDB I/O Threads".
This page describes how to configure the InnoDB I/O Threads.
Configure the Number of InnoDB I/O Threads
In versions up to ES 10.4 and CS 10.4, the number of the InnoDB I/O Threads can be configured by setting the innodb_
Starting with ES 10.5 and CS 10.5, the InnoDB I/O Threads have been replaced by the asynchronous I/O functionality in the InnoDB Background Thread Pool. In these versions, the innodb_256
to determine the maximum number of concurrent asynchronous I/O requests that can be completed by the Background Thread Pool. For example, if innodb_read_io_threads=2
and innodb_write_io_threads=4
are set, InnoDB will be restricted to a maximum of 512 concurrent asynchronous read I/O requests and 1024 concurrent asynchronous write I/O requests.
Interaction with Asynchronous I/O
When asynchronous I/O is enabled, the InnoDB I/O Threads do not receive the initial I/O request from query threads. Instead, the query threads submit asynchronous I/O requests directly to the operating system, and after the operating system performs the operation, the InnoDB I/O Threads handle completion of the request.
Asynchronous I/O is enabled by the innodb_
Affected I/O Operations
The innodb_
Linear read-ahead (configured by innodb_
read_ )ahead_ threshold Random read-ahead (configured by innodb_
random_ )read_ ahead
The innodb_
Page flushing due to adaptive flushing (configured by innodb_
adaptive_ and innodb_flushing adaptive_ )flushing_ lwm Page flushing due to buffer pool capacity (configured by innodb_
max_ and innodb_dirty_ pages_ pct max_ )dirty_ pages_ pct_ lwm Page flushing due to LRU page evictions (configured by innodb_
lru_ and innodb_flush_ size lru_ )scan_ depth
Configuration Procedure
The method to configure the number of I/O threads depends on the server version and whether a server restart will be performed:
Product Versions | Server Restart? | Method |
---|---|---|
ES 10.5 and Later | No | Configure maximum number of asynchronous I/O requests with SET GLOBAL |
Any ES
Any CS
| Yes |
Configure InnoDB's Maximum Number of Asynchronous I/O Requests with SET GLOBAL (ES 10.5) and Later
Starting with MariaDB Enterprise Server 10.5, InnoDB's maximum number of asynchronous I/O requests can be changed dynamically by setting the innodb_SUPER
privilege.
The value of each system variable is multiplied by 256
to determine the maximum number of asynchronous I/O requests that can be performed by the Background Thread Pool. For example, if you want to allow a maximum of 1024 concurrent asynchronous write I/O requests, the innodb_4
(since 1024/256=4
).
To ensure that the change survives server restarts, the innodb_
To configure InnoDB's maximum number of asynchronous I/O requests 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_
read_ and innodb_io_ threads write_ system variables to the new values using the SET GLOBAL statement.io_ threads For example:
SET GLOBAL innodb_read_io_threads=8; SET GLOBAL innodb_write_io_threads=8;
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_
read_ and innodb_io_ threads write_ system variables in the configuration file.io_ threads It needs to be set in a group that will be read by MariaDB Server, such as
[mariadb]
or[server]
.For example:
[mariadb] ... innodb_read_io_threads=8 innodb_write_io_threads=8
Configure the Number of InnoDB I/O Threads in a Configuration File
The number of I/O threads is configured by the innodb_
To configure the number of InnoDB I/O Threads 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_
read_ and innodb_io_ threads write_ system variables in the configuration file.io_ threads It needs to be set in a group that will be read by MariaDB Server, such as
[mariadb]
or[server]
.For example:
[mariadb] ... innodb_read_io_threads=8 innodb_write_io_threads=8
Restart the server:
$ sudo systemctl restart mariadb
Starting with MariaDB Enterprise Server 10.5, the server can use the configuration change without a restart if you use SET GLOBAL.