When a file system reads data from or writes data to a drive by using a driver, it does not immediately send a read/write request to the driver. In this way, the I/O scheduler of the Linux kernel can combine multiple read/write requests into a single one or sort them (reducing addressing of a mechanical drive) and then send the request to the driver, thereby improving system performance.
You are advised to select different schedulers in different application scenarios.
1. Completely Fair Queuing (CFQ) scheduler
The default I/O scheduler used for the Linux kernel before. It assigns a scheduling queue to each process and allocates I/O resources based on the given time slices and number of requests by default to maintain fairness in its distribution of I/O resources to processes. This algorithm is not user-friendly when the I/O pressure is high and I/Os are mainly used in specific processes.
2. Deadline scheduler
This scheduling algorithm maintains four queues: read queue, write queue, timeout read queue, and timeout write queue. When the kernel receives a new request, it merges or sorts the request. If the request cannot be merged or the request has no place to insert, add it to the end of the read or write queue. After a period of time, the I/O scheduler adds the requests in the read or write queue to the timeout read queue or timeout write queue respectively. This algorithm does not limit the I/O resources for each process. It is applicable to scenarios where the I/O pressure is high and I/Os are used in specific processes, for example, big data and databases using HDDs.
3. NOOP (or NONE) scheduler, a simple FIFO scheduling policy
SSDs support random read/write. Therefore, you can select the simplest scheduling policy for SSDs to achieve the best performance.