Rate This Document
Findability
Accuracy
Completeness
Readability

Using Asynchronous File Operation libaio to Improve System Performance

Principle

For disk files, file reading is synchronous. As a result, when a thread reads files, the thread is blocked. To improve performance and disk throughput, the program creates several independent disk read/write threads and uses mechanisms such as semaphore to implement inter-thread communication (with locks). Obviously, if there are many threads and locks, more resources will be preempted, which deteriorates the overall system performance.

The libaio provides an asynchronous mechanism for reading and writing disk files, preventing file read and write from being blocked. With the epoll mechanism, a thread can run without block and process multiple file read and write requests at the same time, improving the overall server performance.

Modification Method

For details, see libaio Implementation Reference in the appendix.