MYSQL-INNODB scenarios where asynchronous IO is used
In general InnoDB only uses asynchronous IO for data files, in order to save logs that are actually written to disk, InnoDB does not enable asynchronous IO for log files
Update in one step, InnoDB only read-ahead the data file, write these two operations enable asynchronous IO
Second, asynchronous IO solves the problem in MySQL:
Before the IO function, InnoDB read and write requests to the data are first placed in the task queue, background read-thread, write-thread from the task queue
Take out tasks and perform read and write operations; The number of background read and write threads can be viewed through the show Engine INNODB status statement
show engine InnoDB status;--------FILEI/O--------I/O thread0State:waiting forI/O Request (Insertbuffer thread) I/O thread1State:waiting forI/O Request (Logthread) I/O thread2State:waiting forI/O Request (Readthread) I/O thread3State:waiting forI/O Request (Readthread) I/O thread4State:waiting forI/O Request (Readthread) I/O thread5State:waiting forI/O Request (Readthread) I/O thread6State:waiting forI/o request (write thread) I/O thread7State:waiting forI/o request (write thread) I/O thread8State:waiting forI/o request (write thread) I/O thread9State:waiting forI/o request (write thread) Pending normal AIO reads:[0, 0, 0, 0], Aio writes:[0, 0, 0, 0], Ibuf Aio reads:,LogI/O's:, sync I/O's:pending Flushes (fsync)Log:0; Buffer pool:0376OSfileReads WuOSfileWrites,7OS Fsyncs41.77Reads/S21886 avgbytes/Read,6.00Writes/S0.78Fsyncs/S
As you can see from the above, InnoDB will have 4 Read-thread and 4 write-thread by default, the problem is here, if the business is heavy, then
Read and write tasks are much more, and InnoDB has only eight read-write threads, so that other read-write requests in the queue do not get a timely response.
The introduction of asynchronous IO after the weather, read and write requests are no longer as before in the queue, waiting for the background of the read-write thread to perform the task;
----
mysql-5.7 Using asynchronous I/O on Linux