文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 17 InnoDB 存储引擎 / 17.8 InnoDB 配置 / 17.8.5 配置后台 InnoDB I/O 线程数
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

17.8.5 配置后台 InnoDB I/O 线程数量17.8.5 Configuring the Number of Background InnoDB I/O Threads

InnoDB 使用后台 线程 来处理各种类型的 I/O 请求。您可以使用 innodb_read_io_threads 和 innodb_write_io_threads 配置参数来设置处理数据页读写 I/O 的后台线程数量。这些参数分别表示用于读和写请求的后台线程数量。它们在所有支持的平台上都有效。您可以在 MySQL 配置文件(my.cnf 或 my.ini)中设置这些参数的值;您不能动态更改这些值。innodb_read_io_threads 的默认值是系统可用逻辑处理器数量除以 2,最小默认值为 4。innodb_write_io_threads 的默认值是 4。两个选项允许的值范围都是 1-64。InnoDB uses background threads to service various types of I/O requests. You can configure the number of background threads that service read and write I/O on data pages using the innodb_read_io_threads and innodb_write_io_threads configuration parameters. These parameters signify the number of background threads used for read and write requests, respectively. They are effective on all supported platforms. You can set values for these parameters in the MySQL option file (my.cnf or my.ini); you cannot change values dynamically. The default value for innodb_read_io_threads is the number of available logical processors on the system divided by 2, with a minimum default value of 4. The default value for innodb_write_io_threads is 4. The permissible values range from 1-64 for both options.

这些配置选项的目的是使 InnoDB 在高端系统上具有更好的可扩展性。每个后台线程最多可以处理 256 个待处理的 I/O 请求。后台 I/O 的一个主要来源是 预读 请求。InnoDB 尝试以一种方式平衡传入请求的负载,使大多数后台线程能够均等地分担工作。InnoDB 还尝试将来自同一区段的读取请求分配给同一线程,以增加合并请求的可能性。如果你拥有高端 I/O 子系统,并且在 SHOW ENGINE INNODB STATUS 输出中看到超过 64 × innodb_read_io_threads 个待处理的读取请求,你可以通过增加 innodb_read_io_threads 的值来提高性能。The purpose of these configuration options to make InnoDB more scalable on high end systems. Each background thread can handle up to 256 pending I/O requests. A major source of background I/O is read-ahead requests. InnoDB tries to balance the load of incoming requests in such way that most background threads share work equally. InnoDB also attempts to allocate read requests from the same extent to the same thread, to increase the chances of coalescing the requests. If you have a high end I/O subsystem and you see more than 64 × innodb_read_io_threads pending read requests in SHOW ENGINE INNODB STATUS output, you might improve performance by increasing the value of innodb_read_io_threads.

在 Linux 系统上,InnoDB 默认使用异步 I/O 子系统来对数据文件页面执行预读和写入请求,这改变了 InnoDB 后台线程处理这些类型 I/O 请求的方式。更多信息,请参见 第 17.8.6 节,“在 Linux 上使用异步 I/O”。On Linux systems, InnoDB uses the asynchronous I/O subsystem by default to perform read-ahead and write requests for data file pages, which changes the way that InnoDB background threads service these types of I/O requests. For more information, see Section 17.8.6, “Using Asynchronous I/O on Linux”.

关于 InnoDB I/O 性能的更多信息,请参见 第 10.5.8 节,“优化 InnoDB 磁盘 I/O”。For more information about InnoDB I/O performance, see Section 10.5.8, “Optimizing InnoDB Disk I/O”.