mysql io调度_修改LINUX IO调度算法 提高数据库吞吐

IO调度器的总体目标是希望让磁头能够总是往一个方向移动,移动到底了再往反方向走,这恰恰就是现实生活中的电梯模型,所以IO调度器也被叫做电梯.(elevator)而相应的算法也就被叫做电梯算法.而Linux中IO调度的电梯算法有好几种,一个叫做as(Anticipatory),一个叫做cfq(Complete

Fairness Queueing),一个叫做deadline,还有一个叫做noop(No

Operation).具体使用哪种算法我们可以在启动的时候通过内核参数elevator来指定.

另一方面我们也可以单独的为某个设备指定它所采用的IO调度算法,这就通过修改在/sys/block/sda/queue/目录下面的scheduler文件.比如我们可以先看一下我的这块硬盘:

[root@localhost ~]# cat /sys/block/sda/queue/scheduler

noop anticipatory deadline [cfq]

可以看到我们这里采用的是cfq.

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.

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 LILO, you can use the ‘append’ keyword:

image=/boot/vmlinuz-2.6.14.2

label=14.2

append=”elevator=deadline”

read-only

optional

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//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.

(hda is the ):

[root@cfs2]# cat /sys/block/hda/queue/scheduler

noop [anticipatory] deadline cfq

[root@cfs2 ~]# echo deadline >

/sys/block/hda/queue/scheduler

[root@cfs2 ~]# cat /sys/block/hda/queue/scheduler

noop anticipatory [deadline] cfq

The other schedulers (anticipatory and cfq) are better su

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值