首页 > 服务器 > 管理维护 > 正文

2.6内核改变系统IO调度算法

2024-09-10 14:18:59
字体:
来源:转载
供稿:网友

2.6内核的四种调度算法

In the 2.6 kernel series, there are four interchangeable schedulers, as follows:

cfq- “Completely Fair Queuing” makes a good default for most workloads on general-purpose servers. 

as – “Anticipatory Scheduler” is best for workstations and other systems with slow, single-spindle storage.

deadline – “Deadline” is a relatively simple scheduler which tries to minimize I/O latency by re-ordering requests to improve performance. Deadline的I/O调度器,在数据吞吐量非常大的数据库系统中表现得更有优势。

noop- “NOOP” is the most simple scheduler of all, and is really just a single FIFO queue.

修改默认的IO调度算法

There are two ways to change the I/O scheduler – at boot time, or with new kernels at runtime. For all Linux kernels, appending ‘elevator={noop|deadline}’ to the kernel boot string sets the I/O elevator.

With GRUB, append the string to the end of the kernel command:

title Fedora Core (2.6.9-5.0.3.EL_lustre.1.4.2custom)
root (hd0,0)
kernel /vmlinuz-2.6.9-5.0.3.EL_lustre.1.4.2custom ro
root=/dev/VolGroup00/LogVol00 rhgb noapic quiet elevator=deadline

With newer Linux kernels (Red Hat Enterprise Linux v3 Update 3 does not have this feature. It is present in the main Linux tree as of 2.6.15), one can change the scheduler while running. If the file /sys/block/<DEVICE>/queue/scheduler exists (where DEVICE is the block device you wish to affect), it will contain a list of available schedulers and can be used to switch the schedulers.

(sda is the <disk>):

[root@cfs2]# cat /sys/block/sda/queue/scheduler
noop [anticipatory] deadline cfq
[root@cfs2 ~]# echo deadline > /sys/block/sda/queue/scheduler
[root@cfs2 ~]# cat /sys/block/sda/queue/scheduler
noop anticipatory [deadline] cfq

The other schedulers (anticipatory and cfq) are better suited for desktop use.

查看当前的IO调度算法

dmesg | grep -i schedular

英文信息copy from lustre manual

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表