Configuring the InnoDB I/O Threads
Topics on This Page:
InnoDB uses I/O threads to perform various I/O operations in the background.
The number of the InnoDB I/O threads is configurable. If your server appears to be spending a lot of time waiting on I/O requests, then you may need to increase the number of I/O threads.
Dynamically Changing the Number of InnoDB I/O Threads
In MariaDB Enterprise Server 10.5, the number of InnoDB I/O threads can be changed dynamically. To ensure that the change survives server restarts, the change should also be made in a configuration file.
Connect to the server using MariaDB Client as the
root@localhost
user account or another user account with theSUPER
privilege:$ sudo mariadb
Set the innodb_read_io_threads and innodb_write_io_threads system variables to the new values using the SET GLOBAL statement.
For example:
SET GLOBAL innodb_read_io_threads=8; SET GLOBAL innodb_write_io_threads=8;
Choose a configuration file in which to configure the innodb_read_io_threads and innodb_write_io_threads system variables.
It not recommended to make custom changes to one of the bundled configuration files. Instead, it is recommended to create a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. If you want your custom configuration file to override the bundled configuration files, then it is a good idea to prefix the custom configuration file's name with a string that will be sorted last, such as
z-
.On RHEL, CentOS, and SLES, a good custom configuration file would be:
/etc/my.cnf.d/z-custom-my.cnf
On Debian and Ubuntu, a good custom configuration file would be:
/etc/mysql/mariadb.conf.d/z-custom-my.cnf
Set the innodb_read_io_threads and innodb_write_io_threads system variables in the configuration file.
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
Configuring the the Number of InnoDB I/O Threads
The number of I/O threads is configured by the innodb_read_io_threads and innodb_write_io_threads system variables.
Choose a configuration file in which to configure the innodb_read_io_threads and innodb_write_io_threads system variables.
It not recommended to make custom changes to one of the bundled configuration files. Instead, it is recommended to create a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. If you want your custom configuration file to override the bundled configuration files, then it is a good idea to prefix the custom configuration file's name with a string that will be sorted last, such as
z-
.On RHEL, CentOS, and SLES, a good custom configuration file would be:
/etc/my.cnf.d/z-custom-my.cnf
On Debian and Ubuntu, a good custom configuration file would be:
/etc/mysql/mariadb.conf.d/z-custom-my.cnf
Set the innodb_read_io_threads and innodb_write_io_threads system variables in the configuration file.
It needs to be set in a group that will be read by MariaDB Server, such as
[mariadb]
or[server]
.For example:
[mariadb] ... innodb_purge_threads=8
Restart the server. You can avoid the need to restart in MariaDB Enterprise Server 10.5 by dynamically changing the number of purge threads.
To restart the server on operating systems that use systemd:
$ sudo systemctl restart mariadb
On systems that use Upstart:
$ sudo service mysql restart