IO scheduling algorithm

Source: Internet
Author: User

Brief introduction:

When a data block is written to the device or read from the device, the request is placed in a queue waiting to be completed.

Each block device has its own queue.

The I/O Scheduler is responsible for maintaining the order of these queues to make more efficient use of the media. The I/O scheduler turns unordered I/O operations into ordered I/O operations.

The kernel must first determine how many requests there are in the queue before it starts scheduling.

4 kinds of algorithms for I/O scheduling

1) CFQ (Completely Fair Queuing, complete fair line)

Characteristics:

     in the latest kernel version and release, choose CFQ as the default I/O Scheduler, the best choice for a common server .     cfq trying to evenly distribute access to I/O bandwidth, Avoiding starvation of processes and achieving lower latency is the tradeoff between deadline and as Schedulers .     CFQ is the best choice for multimedia applications (Video,audio) and desktop systems .     The CFQ gives the I/O request a priority, and the I/O priority requests are independent of the process priority, and the high-priority process reads and writes cannot automatically inherit high I/O priorities. How it works:     CFQ for each process/ The thread creates a separate queue to manage the requests generated by the process, that is, each process is queued, scheduling between queues using time slices to ensure that each process is well allocated to the I/O bandwidth. The I/O Scheduler executes 4 requests per process at a time.  2) NOOP ( Elevator scheduler) features:     in Linux2.4 or earlier versions of the scheduler, then only this kind of I/O scheduling algorithm .     NoOp implemented a FIFO queue, It organizes the I/O requests like the work of the elevator, and when a new request arrives, it merges the request into the most recent request to ensure that the same media .     NoOp tends to starve to read and is conducive to writing .      NoOp is the best choice for flash memory devices, RAM, and embedded systems. Elevator algorithm Starvation read request explanation:     because write requests are easier than read requests .     write requests through the file system cache, You do not have to wait for a write to complete, you can start the next write operation, write requests by merging, accumulate into the I/O queue .     read requests need to wait until all of the read operations are completed before the next read operation. There are a few milliseconds between reads, And the writing request came in between, starved to the back of the read request.  3) Deadline (Deadline Scheduler) features:     classification by time and hard drive area, this classification and merging requirement is similar to NoOp scheduler.      deadline ensures that it is taken orally at a cut-off timeService request, the deadline is adjustable, and the default read period is shorter than the write period. This prevents the write operation from starving because it cannot be read .     deadline is the best choice for database environments (ORACLE Rac,mysql, etc.).  4) as (expected I/O scheduler) features:     essentially the same as deadline, but after the last read operation, wait for 6ms to continue scheduling other I/O requests .      can subscribe to a new read request from the application, improve the execution of the read operation, but at the expense of some writes .     It inserts new I/O operations into each 6ms, but merges some small write streams into a single uppercase stream. Write latency for maximum write throughput .     as is suitable for writing more environments, such as file server      As for poor performance of the database environment .  view I/O scheduling for the current system
1 Cat /sys/block/sda/queue/Scheduler2

Temporarily change I/O scheduling

1 echo noop >/sys/block/sda/queue/scheduler

IO scheduling algorithm

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.