选择Linux I/O调度程序 [英] Selecting a Linux I/O Scheduler

查看:136
本文介绍了选择Linux I/O调度程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到可以通过写入/sys/block/[disk]/queue/scheduler来更改正在运行的内核上特定设备的I/O调度程序.例如,我可以在系统上看到:

I read that it's supposedly possible to change the I/O scheduler for a particular device on a running kernel by writing to /sys/block/[disk]/queue/scheduler. For example I can see on my system:

anon@anon:~$ cat /sys/block/sda/queue/scheduler 
noop anticipatory deadline [cfq] 

默认值为完全公平的队列调度程序.我想知道的是,在自定义内核中包括所有四个调度程序是否有任何用处.除非内核足够聪明地为正确的硬件选择正确的调度程序,特别是对于基于闪存的驱动器的"noop"调度程序,以及对于传统驱动器的其他调度程序,否则编译一个以上的调度程序似乎没有多大意义.硬盘驱动器.

that the default is the completely fair queuing scheduler. What I'm wondering is if there is any use in including all four schedulers in my custom kernel. It would seem that there's not much point in having more than one scheduler compiled in unless the kernel is smart enough to select the correct scheduler for the correct hardware, specifically the 'noop' scheduler for flash based drives and one of the others for a traditional hard drive.

是这样吗?

推荐答案

As documented in /usr/src/linux/Documentation/block/switching-sched.txt, the I/O scheduler on any particular block device can be changed at runtime. There may be some latency as the previous scheduler's requests are all flushed before bringing the new scheduler into use, but it can be changed without problems even while the device is under heavy use.

# cat /sys/block/hda/queue/scheduler
noop deadline [cfq]
# echo anticipatory > /sys/block/hda/queue/scheduler
# cat /sys/block/hda/queue/scheduler
noop [deadline] cfq

理想情况下,只有一个调度程序可以满足所有需求.它似乎还不存在.内核通常没有足够的知识来为您的工作负载选择最佳的调度程序:

Ideally, there would be a single scheduler to satisfy all needs. It doesn't seem to exist yet. The kernel often doesn't have enough knowledge to choose the best scheduler for your workload:

  • noop通常是内存支持的块设备(例如ramdisk)和其他非旋转介质(闪存)的最佳选择,在这些设备中尝试重新计划I/O会浪费资源
  • deadline是一种轻量级的调度程序,试图对延迟进行严格限制
  • cfq尝试维护I/O带宽在系统范围内的公平性
  • noop is often the best choice for memory-backed block devices (e.g. ramdisks) and other non-rotational media (flash) where trying to reschedule I/O is a waste of resources
  • deadline is a lightweight scheduler which tries to put a hard limit on latency
  • cfq tries to maintain system-wide fairness of I/O bandwidth

很长时间以来,默认设置为anticipatory,并且进行了大量调整,但在 2.6.33 (2010年初)中被删除. cfq早已成为默认设置,因为它的性能合理且公平是多用户系统(甚至单用户桌面)的一个好目标.在某些情况下-数据库经常被用作示例,因为它们已经具有自己独特的调度和访问模式,并且通常是最重要的服务(所以谁在乎公平性?)- anticipatory长期以来一直处于可调状态,以在这些工作负载上实现最佳性能,并且deadline很快将所有请求传递到基础设备.

The default was anticipatory for a long time, and it received a lot of tuning, but was removed in 2.6.33 (early 2010). cfq became the default some while ago, as its performance is reasonable and fairness is a good goal for multi-user systems (and even single-user desktops). For some scenarios -- databases are often used as examples, as they tend to already have their own peculiar scheduling and access patterns, and are often the most important service (so who cares about fairness?) -- anticipatory has a long history of being tunable for best performance on these workloads, and deadline very quickly passes all requests through to the underlying device.

这篇关于选择Linux I/O调度程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆