充分利用CPU多核的处理能力 innodb_read_io_threads和innodb_write_io_threads

https://book.2cto.com/201402/40300.html

在MySQL5.1.X版本中,innodb_file_io_threads参数默认是4,该参数在Linux系统上是不可更改的,但Windows系统上可以调整。这个参数的作用是:InnoDB使用后台线程处理数据页上读写I/O(输入输出)请求的数量。

在MySQL5.5.X版本中,或者说是在InnoDB Plugin1.0.4以后,就用两个新的参数,即innodb_read_io_threads和innodb_write_io_threads,取代了innodb_file_io_threads如此调整后,在Linux平台上就可以根据CPU核数来更改相应的参数值了,默认是4。

假如CPU是2颗8核的,那么可以设置:
innodb_read_io_threads = 8
innodb_write_io_threads = 8

如果数据库的读操作比写操作多,那么可以设置:
innodb_read_io_threads = 10
innodb_write_io_threads = 6

也就是说,你可以根据情况加以设置。

注意

这两个参数不支持动态改变,需要把该参数加入my.cnf里,修改完后重启MySQL服务,允许值的范围是1~64。

调整完成后,你可以用命令“show engine innodb status\G;”来查看调整结果,如下所示:
show engine innodb status
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)

关于innodb_read_io_threads和innodb_write_io_threads参数的含义,请参见MySQL5.5 手册:
充分利用CPU多核的处理能力 innodb_read_io_threads和innodb_write_io_threads

上一篇:js字符串倒序


下一篇:HTML5的placeHolder在IE9下workaround引发的Bug(按下葫芦起了瓢)