Linux kernel Explore IO scheduling

Source: Internet
Author: User

Linux kernel Explore IO scheduling

Why do we need to adjust the disk I/O scheduling algorithm? Under what circumstances do we need to consider adjusting the scheduling algorithm? How do I adjust it? This article will give some answers to the above questions.

I/o scheduling is an algorithm rule for operating system access block order, and in some cases we may be more familiar with calling it disk scheduling.

We may need to consider tuning the disk's scheduling algorithm for the following purposes:

minimizing disk seek time;

Optimize I/O requests for critical processes to ensure critical process I/O requests;

Let the process on the server share the I/O bandwidth better;

Before the RHEL3 version we had only one elevator algorithm to choose from, due to the limitations of the algorithm so after the RHEL4 version, we have the following 4 algorithms to choose from:

Cfq-completely Fair queuing

Noop-noop Scheduler,no operation

Deadline Scheduler

Anticipatory scheduling

Below for the above 4 algorithms to understand the specific algorithm rules.

The first is CFQ, the algorithm is the most released Linux version of the default algorithm, all called the complete Fair queue algorithm, the algorithm attempts to fair the I/O bandwidth resources to all processes, the process submits the request into the respective queue (64 queues), As a result, requests submitted by the same process are usually stored in the same queue, and in most cases, most applications are applied.

NOOP, this algorithm is the simplest, takes up the minimum CPU scheduling time, follows the fifo-FIFO principle to dispatch the I/O request, but it is not always the case, because it will still do some merging with the process of the adjacent I/O request. In the case of storage hardware and disk optimization, the algorithm information is good, such as SSD.

Deadline, the last-term algorithm, the most important thing is to avoid the CFQ algorithm in some requests for a long time without the resources starved of the situation occurs. 4 queues, 2 read-write queues, and 2 read-write deadline queues were used, and the deadline queue was queued according to their expiration time. The algorithm reads the request priority higher than the write request, so the first completion of the read request queue (unless the write request has been discarded, death many times), then check the 1th request expiration time, the read request expires at 500MS, the write request expires at 5s, if the deadline to check the 1th request has passed, Then move it to the end of the queue. For real-time requests, the recommended database or Web server system uses the algorithm.

Anticipatory, the expected algorithm, which is the most complex of an algorithm, is actually not so optimized, since kernel 2.6.33 has been removed.

recommended by the upper description and also verified, for the Oracle database environment, we can prioritize the selection of the deadline algorithm.

How can I see the scheduling algorithms that are currently in use by the system?

Cat/sys/block/{device-name}/queue/scheduler

Cat/sys/block/sda/queue/scheduler

To modify the scheduling algorithm:

echo {Scheduler-name} >/sys/block/{device-name}/queue/scheduler

echo NoOp >/sys/block/hda/queue/scheduler

Finally, all of the above is a rip, no algorithm is optimal, in different applications, hardware environment, only one test to choose the most suitable algorithm.

-eof-

    • This article is from: Linux Learning Tutorial Network

Linux kernel Explore IO scheduling

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.