Skip to content

Instantly share code, notes, and snippets.

@blaudden
Last active August 17, 2021 08:36
Show Gist options
  • Save blaudden/a661372e742a57a6e429ca716611ac30 to your computer and use it in GitHub Desktop.
Save blaudden/a661372e742a57a6e429ca716611ac30 to your computer and use it in GitHub Desktop.
MySQL io_setup() failed with EAGAIN after 5 attempts
# MySQL Server startup fails when the InnoDB storage engine attempts to
# allocate more resources for asynchronous IO than are available on the
# host system.
#
# [MY-012582] [InnoDB] io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
# <snip>
# [MY-012583] [InnoDB] io_setup() attempt 5.
# [MY-012584] [InnoDB] io_setup() failed with EAGAIN after 5 attempts.
# [MY-012587] [InnoDB] You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
# [MY-012954] [InnoDB] Cannot initialize AIO sub-system
#
# The number of aio requests required by MySQL Server is currently calculated using
# the formula:
# 256 * (innodb_read_io_threads + innodb_write_io_threads + 2) + 100
#
# With default values (ie. 4) for innodb-read- and innodb-write_io_threads
# this would mean that the MySQL Server requires 256 * (4 + 4 + 2 ) + 100 =>
# 2660 aio resources.
#
# The default value for Linux Native AIO resources (i.e the max-aio-nr) is
# set to a moderately low value on most distros (for example Ubuntu uses 65536).
# $ cat /proc/sys/fs/aio-max-nr
# 65536
# To check currently in use asynchrounous IO resources, use:
# $ cat /proc/sys/fs/aio-nr
# 18497
#
# When running several MySQL Server instances or other programs making use of
# asynchronous IO resources it will thus be necessary to increase the default
# values of the host system. Running 32 MySQL Server instances with default
# values would require increasing max-aio-nr to at least 32* 2660 => 85120.
#
# On Ubuntu this can be done by placing this file in the /etc/sysctl.d/ directory,
# then either reboot or reload the sysctl settings with:
# $ sudo service procps restart
fs.aio-max-nr = 340480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment