Increase disk queue depth on Linux

The default value of the disk queue_depth and nr_requests can be changed for better disk performance on Linux.

To retrieve the current runtime value of queue_depth:

cat /sys/block/sd*/device/queue_depth3131

To retrieve the current runtime value of nr_requests:

cat /sys/block/sd*/queue/nr_requests10241024

This is an example to increase disk queue depth runtime value on disk sda:

echo 32 >/sys/block/sda/device/queue_depthecho 1024 >/sys/block/sda/queue/nr_requests

You can only set the required value at boottime and, depending on the Linux distribution, you need to do it in /etc/init.d/rc.local (Debian) or /etc/rc.d/rc.local (Centos)