I/O 调度算法再各个进程竞争磁盘I/O的时候担当了裁判的角色。他要求请求的次序和时机做最优化的处理,以求得尽可能最好的整体I/O性能。
下面列出4种调度算法:
CFQ (Completely Fair Queuing 完全公平的排队)(elevator=cfq): 这是默认算法,对于通用服务器来说通常是最好的选择。它试图均匀地分布对I/O带宽的访问。
Deadline (elevator=deadline): 这个算法试图把每次请求的延迟降至最低。该算法重排了请求的顺序来提高性能。
NOOP (elevator=noop): 这个算法实现了一个简单FIFO队列。他假定I/O请求由驱动程序或者设备做了优化或者重排了顺序(就像一个智能控制器完成的工作那样)。在有些SAN环境下,这个选择可能是最好选择。
Anticipatory (elevator=as): 这个算法推迟I/O请求,希望能对它们进行排序,获得最高的效率。对于桌面工作站来说,这个算法可能是一个不错的选择,但对服务器则很少会理想。
Linux Change The I/O Scheduler For A Hard Disk
Q. How do I change the I/O scheduler for a particular hard disk without rebooting my Linux server system?
A. CFQ [cfq] (Completely Fair Queuing) is an I/O scheduler for the Linux kernel and default under many Linux distributions.
Noop scheduler (noop) is the simplest I/O scheduler for the Linux kernel based upon FIFO queue concept.
Anticipatory scheduler (anticipatory) is an algorithm for scheduling hard disk input/output as well as old scheduler which is replaced by CFQ
Deadline scheduler (deadline) - it attempt to guarantee a start service time for a request.
Task: View Current Disk scheduler
Assuming that your disk name /dev/sda, type:
# cat /sys/block/{DEVICE-NAME}/queue/scheduler
# cat /sys/block/sda/queue/scheduler
Sample output:
noop anticipatory deadline [cfq]
Task: Set I/O Scheduler For A Hard Disk
To set a specific scheduler, simply type the command as follows:
# echo {SCHEDULER-NAME} > /sys/block/{DEVICE-NAME}/queue/scheduler
For example, set noop scheduler, enter:
# echo noop > /sys/block/hda/queue/scheduler
阅读(765) | 评论(0) | 转发(0) |