{{ item.name }}
{{ item.name }}

{{ it.name }}

{{ it.text }}

{{ it.name }}

{{ innerIt.name }}

{{ innerIt.text }}

{{news.time}}
{{news.title}}
MySQL主机该如何配置fs.aio-max-nr
2020-05-22发布 1,466浏览

MySQL默认是启用innodb_use_native_aio,使用异步IO操作,MySQL启动时所需aio slot若超过系统当前fs.aio-max-nr设置,则无法启动报错 InnoDB: io_setup() failed with EAGAIN after 5 attempts.


通常在单机单实例环境下很少会遇到超出aio-max-nr的问题,若部署单机多实例,会大概率遇到此问题。


我们来分析下该如何配置fs.aio-max-nr参数。


关于 aio-nr与aio-max-nr






aio-nr is the running total of the number of events specified on theio_setup system call for all currently active aio contexts. If aio-nrreaches aio-max-nr then io_setup will fail with EAGAIN. Note thatraising aio-max-nr does not result in the pre-allocation or re-sizingof any kernel data structures.


启动MySQL时会分配多少个event slot?


使用 strace 观测io_setup 调用情况


strace -fe trace=io_setup  /path/to/mysqld --defaults-file=/etc/my.cnf --daemonize  2>&1 |grep io_setup

总共 4709个 = 18 * 256 + 101

MySQL主机该如何配置fs.aio-max-nr-爱可生



其分配256 event的也就是 InnoDB IO线程

MySQL主机该如何配置fs.aio-max-nr-爱可生



结论


  • 实例申请的fs.aio-nr = (innodb_read_io_threads + innodb_write_io_threads + log thread + insert buffer thread) * 256 + 101

  • 若单实例部署,fs.aio-max-nr 至少大于单实例fs.aio-nr

  • 若多实例部署,至少大于 本机实例数 * 每个实例的fs.aio-nr

上一篇
MySQL里fetchone和fetchall有区别吗
400-820-6580 13916131869
marketing@actionsky.com
上海市闵行区万源路2138号泓茂中心2号楼
产品详情
关系型数据库
AI数据库
数据库智能管理平台
数据库生态产品
行业案例
金融行业
新零售行业
制造业
通信行业
更多
公司动态
最新新闻
国产化信息
技术分享
关于我们
公司简介
公司分布
国家专利
资质认证
扫码关注公众号
© Copyright 2017, All rights reserved by: 上海爱可生信息技术股份有限公司 沪ICP备12003970号-1 | 法律声明 | 网站地图
沪公网安备 31010402003331号