Exploring IO Scheduling in Linux kernel

Source: Internet
Author: User

Linux kernel explores IO Scheduling. Why do we need to adjust the disk I/O scheduling algorithm? Under what circumstances should we consider adjusting the scheduling algorithm? How to adjust it? This article will answer the above questions. I/O scheduling is a general term for the algorithm rules used by the operating system to access the data block sequence. In some cases, we may be more familiar with calling it disk scheduling. For the following purposes, we may need to consider adjusting the disk scheduling algorithm: minimizing disk seek time; optimizing key process I/O requests to ensure I/O requests of key processes; let the processes on the server better share the I/O bandwidth. Before RHEL3, we only have one elevator algorithm to choose from. Due to the limitations of this algorithm, in later RHEL4 versions, we can choose from the following 4 algorithms: CFQ-completely fair queuingNOOP-Noop scheduler, No OperationDeadline schedulerAnticipatory scheduling. The following describes the specific algorithm rules for these four algorithms one by one. The first is CFQ, which is the default algorithm used in most Linux versions released. It is called the fully fair queue algorithm. This algorithm tries to fairly allocate I/o bandwidth resources to all processes, requests submitted by processes are placed in their respective queues (64 queues). Therefore, requests submitted by the same process are usually stored in the same queue, most application systems are applicable in most cases. NOOP: this algorithm is the simplest and occupies the least CPU scheduling time. It schedules I/O requests according to the FIFO-FIFO principle, but this is not always the case, because it will merge processes that are nearing the I/O Request. When the storage hardware and disks are optimized, the information of this algorithm is good, such as SSD. Deadline, the Deadline algorithm. The most important thing of this algorithm is to avoid some requests in the CFQ algorithm that cannot get resources for a long time. 4 queues, 2 read/write queues, and 2 read/write deadline queues are used to queue at the deadline according to their expiration time. In this algorithm, the Read Request has a higher priority than the write request. Therefore, the Read Request queue is completed first (unless the write request has been abandoned and died many times), and the expiration time of the 1st requests is checked, the expiration time of a read request is 500 ms, and the expiration time of a write request is 5 s. If you check that the expiration time of the 1st requests has elapsed, move it to the end of the queue. This algorithm is applicable to real-time request systems. It is recommended that databases or web server systems use this algorithm. Anticipatory, the expected algorithm, is the most complex algorithm. In fact, it is not so optimized and has been removed from kernel 2.6.33. We recommend the Deadline algorithm based on the above description and have been verified. For the Oracle database environment, we can prioritize the Deadline algorithm. How can I view the existing scheduling algorithms used by the system? Cat/sys/block/{DEVICE-NAME}/queue/schedulercat/sys/block/sda/queue/schedue modify the scheduling algorithm: echo {SCHEDULER-NAME}>/sys/block/{DEVICE-NAME}/queue/schedulerecho noop>/sys/block/hda/queue/schedop at the end, no algorithm is optimal. In different applications and hardware environments, you can select the most suitable algorithm only by testing one by one. -EOF-

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.