Setting the queue depth

Red Hat Enterprise Linux 9.2 LPAR mode z/VM guest

The Linux® SCSI code automatically adjusts the queue depth as necessary. Changing the queue depth is usually a storage server requirement.

Before you begin

Check the documentation of the storage server used or contact your storage server support group to establish if there is a need to change this setting.
The information in this topic only applies to the SCSI layer. For block devices, such as SCSI disks, there is also a limit in the Linux block layer. To display the block device limit, issue:
# cat /sys/bus/scsi/devices/<scsi_device_name>/block/*/queue/nr_requests
Alternatively, issue:
# cat /sys/block/sd<X>/queue/nr_requests
The smaller of SCSI device queue_depth and block device nr_requests is the effective setting. For more details about block device requests, see www.kernel.org/doc/html/latest/block/queue-sysfs.html#nr-requests-rw and www.kernel.org/doc/html/latest/block/stat.html#in-flight.

About this task

The value of the queue_depth kernel parameter is used as the default queue depth of new SCSI devices. You can query the queue depth by issuing a command of this form:
# cat /sys/bus/scsi/devices/<SCSI device>/queue_depth
Example:
# cat /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
16
You can change the queue depth of each SCSI device by writing to the queue_depth attribute, for example:
# echo 8 > /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
# cat /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
8
This is useful on a running system where you want to make dynamic changes. If you want to make the changes persistent across IPLs, you can:
Linux forwards SCSI commands to the storage server until the number of pending commands exceeds the queue depth. If the server lacks the resources to process a SCSI command, Linux queues the command for a later retry and decreases the queue depth counter. Linux then waits for a defined ramp-up period. If no indications of resource problems occur within this period, Linux increases the queue depth counter until reaching the previously set maximum value. To query the current value for the queue ramp-up period in milliseconds:
# cat /sys/bus/scsi/devices/0:0:13:1086537744/queue_ramp_up_period
120000
To set a new value for the queue ramp-up period in milliseconds:
# echo 1000 > /sys/bus/scsi/devices/0:0:13:1086537744/queue_ramp_up_period