ncq depth on linux

Linux NCQ (SATA native command queueing) support is enabled automatically, if your SATA drive supports it. At boot, you will see a line in dmesg (or kernel log) like

cat /sys/block/sda/device/queue_depth
31

to disable ncq:

echo 1 > /sys/block/sda/device/queue_depth

dmesg | grep depth
ata1.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

about ncq:

Native Command Queuing (NCQ) is a technology designed to improve performance and reliability as the transactional workload increases on SATA hard disk drives. When multiple read and write commands are sent to the SATA drive, NCQ steps in to optimize the completion of these commands by grouping the commands in order of processing efficiency, thereby reducing the mechanical workload and increase performance from the drive. Without NCQ, the drive would process and complete each command one at a time in the order in which it was received.

ncq benefits:

Works in all systems where host controllers support the SATA NCQ feature including desktop PCs, workstations, digital media content servers, entry servers, as well as high performance PCs and mobile/notebook systems
Provides 100% backward compatibility with non-NCQ supporting systems
Allows the reordering of commands by the storage device to increase the efficiency of its data transfers
Improves seek time performance from hard drives and allows solid state drives to access the stored command queue to boost performance
NCQ is a feature that is designed into the Serial ATA interface. To take advantage of NCQ, both the host controller/chipset and hard drive need to support the feature.

The NCQ-enabled hard drive on the left can execute four commands (A, B, C, and D) in a total of one and a quarter complete rotations due to proper ordering of the operations. The non-NCQ hard drive on the right requires a full two and three quarters rotations to execute the same four commands (A, B, C, and D) as a result of poor ordered operations.

NCQ provides higher performance in heavy transactional workloads traditionally found in high performance workstations, network servers, multi-media servers and editing workstations. NCQ also contributes to improved overall system performance in various computing operations including system booting to file copying.

Leave a Reply

Your email address will not be published. Required fields are marked *