In Linux systems, the IO scheduler is a mechanism used to manage disk requests, which can improve disk performance and efficiency. Different IO schedulers have different characteristics and applicable scenarios, so choosing an appropriate IO scheduler is very important to optimize the operation of the Linux system.
Currently there are the following I/O scheduling algorithms on Linux:
noop - 通常用于内存存储的设备。 cfq - 完全公平调度器。进程平均使用IO带宽。 Deadline - 针对延迟的调度器,每一个 I/O,都有一个最晚执行时间。 Anticipatory - 启发式调度,类似 Deadline 算法,但是引入预测机制提高性能。
How to operate the i/o scheduler
View the current I/O scheduler of the device:
# cat /sys/block//queue/scheduler
Assume the disk name is /dev/sdc:
# cat /sys/block/sdc/queue/scheduler noop anticipatory deadline [cfq]
How to change the hard disk device I/O scheduler
Use the following commands:
# echo {SCHEDULER-NAME} > /sys/block//queue/scheduler
For example, setting the noop scheduler:
# echo noop > /sys/block/sdc/queue/scheduler
Permanent change of i/o scheduler
The above settings will become invalid after restarting. If you want the configuration to still take effect after restarting, you need to write elevator=noop in the kernel startup parameters to /boot/grub/menu.lst:
1. Back up the menu.lst file
cp -p /boot/grub/menu.lst /boot/grub/menu.lst-backup
2. Update /boot/grub/menu.lst
Add elevator=noop to the end of the file, for example:
kernel /vmlinuz-2.6.16.60-0.91.1-smp root=/dev/sysvg/root splash=silent splash=off showopts elevator=noop>
The above is the detailed content of Linux IO scheduler: principles, characteristics and optimization methods. For more information, please follow other related articles on the PHP Chinese website!