mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-16 22:42:21 +08:00
honpey translate How to Change Linux IO Scheduler
This commit is contained in:
parent
e560f8e79b
commit
223afa019a
sources/tech
translated
@ -1,73 +0,0 @@
|
|||||||
honpey is tranlating
|
|
||||||
|
|
||||||
How to Change Linux I/O Scheduler
|
|
||||||
==================================
|
|
||||||
|
|
||||||
|
|
||||||
Linux I/O Scheduler is a process of accessing the block I/O from storage volumes. I/O scheduling is sometimes called disk scheduling. Linux I/O scheduler works by managing a block device’s request queue. It selects the order of requests in the queue and at what time each request is sent to the block device. Linux I/O Scheduler manages the request queue with the goal of reducing seeks, which results in great extent for global throughput.
|
|
||||||
|
|
||||||
There are following I/O Scheduler present on Linux:
|
|
||||||
|
|
||||||
1. noop – is often the best choice for memory-backed block devices
|
|
||||||
2. cfq – A fairness-oriented scheduler. It tries to maintain system-wide fairness of I/O bandwidth.
|
|
||||||
3. Deadline – A latency-oriented I/O scheduler. Each I/O request has got a deadline assigned.
|
|
||||||
4. Anticipatory – conceptually similar to deadline, but with more heuristics to improve performance.
|
|
||||||
|
|
||||||
To View Current Disk scheduler:
|
|
||||||
|
|
||||||
```
|
|
||||||
# cat /sys/block/<Disk_Name>/queue/scheduler
|
|
||||||
```
|
|
||||||
|
|
||||||
Let’s assume that , disk name is /dev/sdc, type:
|
|
||||||
|
|
||||||
```
|
|
||||||
# cat /sys/block/sdc/queue/scheduler
|
|
||||||
noop anticipatory deadline [cfq]
|
|
||||||
```
|
|
||||||
|
|
||||||
### To change Linux I/O Scheduler For A Hard Disk:
|
|
||||||
|
|
||||||
To set a specific scheduler, simply type below command:
|
|
||||||
|
|
||||||
```
|
|
||||||
# echo {SCHEDULER-NAME} > /sys/block/<Disk_Name>/queue/scheduler
|
|
||||||
```
|
|
||||||
|
|
||||||
For example,to set noop scheduler, enter:
|
|
||||||
|
|
||||||
```
|
|
||||||
# echo noop > /sys/block/sdc/queue/scheduler
|
|
||||||
```
|
|
||||||
|
|
||||||
The above change is valid till reboot of the server , to make this change permanent across reboot follow below procedure:
|
|
||||||
|
|
||||||
Implement permanent setting by adding “elevator=noop” to the default para in the /boot/grub/menu.lst file
|
|
||||||
|
|
||||||
#### 1. Create backup of menu.lst file
|
|
||||||
|
|
||||||
```
|
|
||||||
cp -p /boot/grub/menu.lst /boot/grub/menu.lst-backup
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Update /boot/grub/menu.lst
|
|
||||||
|
|
||||||
Now add “elevator=noop” at the end of the line as below:
|
|
||||||
|
|
||||||
Example
|
|
||||||
|
|
||||||
```
|
|
||||||
kernel /vmlinuz-2.6.16.60-0.91.1-smp root=/dev/sysvg/root splash=silent splash=off showopts elevator=noop
|
|
||||||
```
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: http://linuxroutes.com/change-io-scheduler-linux/
|
|
||||||
|
|
||||||
作者:[UX Techno][a]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:http://linuxroutes.com/change-io-scheduler-linux/
|
|
66
translated/20160104 How to Change Linux IO Scheduler.md
Normal file
66
translated/20160104 How to Change Linux IO Scheduler.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
如何更改IO调度器
|
||||||
|
==================================
|
||||||
|
|
||||||
|
Linux IO 调度器,IO调度器也叫磁盘调度器。Linux IO调度器的机制主要是控制块设备的请求队列:确定队列中哪些IO的优先级更高以及何时下发IO,以此来减少磁盘寻道时间,从而提高系统的吞吐量。
|
||||||
|
|
||||||
|
目前Linux上有如下几种IO调度算法:
|
||||||
|
|
||||||
|
1. noop - 通常用于内存存储的设备.
|
||||||
|
2. cfq - 绝对公平调度器. 进程平均使用IO带宽.
|
||||||
|
3. Deadline - 每一个IO,都有一个最晚执行时间.
|
||||||
|
4. Anticipatory - 启发式调度,类似Deadline算法,但是引入预测机制提高性能.
|
||||||
|
|
||||||
|
查看设备当前的IO调度器:
|
||||||
|
|
||||||
|
```
|
||||||
|
# cat /sys/block/<Disk_Name>/queue/scheduler
|
||||||
|
```
|
||||||
|
|
||||||
|
假设磁盘名称是 /dev/sdc:
|
||||||
|
|
||||||
|
```
|
||||||
|
# cat /sys/block/sdc/queue/scheduler
|
||||||
|
noop anticipatory deadline [cfq]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 如何改变硬盘设备I/O调度器
|
||||||
|
|
||||||
|
使用如下指令:
|
||||||
|
|
||||||
|
```
|
||||||
|
# echo {SCHEDULER-NAME} > /sys/block/<Disk_Name>/queue/scheduler
|
||||||
|
```
|
||||||
|
|
||||||
|
比如设置 noop 调度器:
|
||||||
|
|
||||||
|
```
|
||||||
|
# echo noop > /sys/block/sdc/queue/scheduler
|
||||||
|
```
|
||||||
|
|
||||||
|
以上设置重启后会失效,要想重启后配置仍生效,需要在内核启动参数中将 "elevator=noop" 写入 /boot/grub/menu.lst:
|
||||||
|
|
||||||
|
#### 1. 备份 menu.lst 文件
|
||||||
|
|
||||||
|
```
|
||||||
|
cp -p /boot/grub/menu.lst /boot/grub/menu.lst-backup
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. 更新 /boot/grub/menu.lst
|
||||||
|
|
||||||
|
将 "elevator=noop" 添加到文件末尾,比如:
|
||||||
|
|
||||||
|
```
|
||||||
|
kernel /vmlinuz-2.6.16.60-0.91.1-smp root=/dev/sysvg/root splash=silent splash=off showopts elevator=noop
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linuxroutes.com/change-io-scheduler-linux/
|
||||||
|
|
||||||
|
作者:[UX Techno][a]
|
||||||
|
译者:[honpey](https://github.com/honpey)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://linuxroutes.com/change-io-scheduler-linux/
|
Loading…
Reference in New Issue
Block a user