How to reduce the IO wait time (input output wait time) by changing the IO Scheduler
The I/O subsystem is a group of processes responsible for transferring data blocks between disk and memory. I/O subsystem processes the read/write requests based on scheduler algorithms (also known as "Elevators").
There are several types of schedulers:
• deadline: The deadline scheduler assigns an expiration time to every request and the request is processed when it reaches to its given expiration time, thus provides a specific amount of time to each request. The deadline scheduler is good for the systems getting a lot of small read request provided the requests are for the data block close to each other on the disk. In case if the requests are for data blocks far from each other on disk then deadline scheduler may increase the latency.
• as : The anticipatory scheduler waits for sometime after servicing an I/O requests and before serving the next request, giving time to the first request as it might give next I/O request for the next block of data on disk. The anticipatory scheduler is beneficial when you have a single application frequently requesting for lot of reads.
The disadvantage of anticipatory scheduler is that, it may cause a overall delay if your application is interrupted by external requests.
• cfq : The cfq (completely fair queuing) scheduler equally divides all I/O bandwidth among all processes issuing I/O requests. The cfq scheduler is good for systems with multiple I/O controllers, scsi/iscsi connections like LUNs.
• noop : The noop scheduler puts requests into a unordered queue and they are processed in a FIFO(first in first out) order. The noop scheduler is good where I/O performance is done by a host bus adapter, or a external disk controller.
Changing a scheduler:
To change or select a scheduler persistently edit the /boot/grub/grub.conf file and add elevator=<name of scheduler> at the end of kernel line. For Example:
title CentOS Server (2.6.18-32.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.18-32 ro root=LABEL=/1 rhgb quiet elevator=noop initrd /boot/initrd-2.6.18-32.imgTo change or select a scheduler temporarily, echo the name of scheduler in /sys/block/<device>/queue/scheduler replace <device> with actual device name like hda or sda. For example:
[root@server ~]# echo noop > /sys/block/hda/queue/scheduler
[root@server ~]# cat /sys/block/hda/queue/scheduler
[noop] anticipatory deadline cfq
[root@server ~]#
We can also configure the udev to change the scheduler when the iSCSI or Fiber Channel device is plugged in:
[root@server ~]# vi /etc/udev/rules.d/95-san.rules
# To Set "noop" as I/O scheduler for iSCSI and Fiber Channel devices
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-iscsi-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-fc-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"

Comments
Setting I/O scheduler at boot
More elegant solution is config the udev for iSCSI and Fiber Channel SAN devices
# vi /etc/udev/rules.d/95-san.rules
Set "noop" as I/O scheduler for iSCSI and Fiber Channel devices
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-iscsi-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-fc-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"
Thanks Manish
I have Updated the Article. Thanks for your suggestion.
I am typically to blogging
I am typically to blogging and i actually respect your content. The article has really peaks my interest. I am going to bookmark your website and preserve checking for brand spanking new information.