5

Why is it recommended in a MD RAID (mdadm) to disable NCQ per-disk? echo 1 > /sys/block/sdX/device/queue_depth

I read this tip in many articles regarding RAID tuning but nobody explains why.

2 Answers2

3

Thanks for your answer.

Wikipedia states "NCQ can negatively interfere with the operating system's I/O scheduler, actually decreasing performance" and it refers to this article http://www.cs.albany.edu/~sdc/CSI500/Fal10/DiskArmSchedulingPapers/a2-yu.pdf

This article states "Under a random workload, the I/O scheduler should be disabled, that is, noop, and NCQ in charge of scheduling requests entirely; when under a sequential workload, an I/O scheduler should take full charge of scheduling them instead of NCQ. It implies that the type of information that can help scheduling decision can vary according to the workload type."

Thus it seems to be a problem under a sequential workload, but not under a random workload.

At conclusions it states that "In the long run, we suggest that a new SATA 2 specification should contain a well-defined interface to fully control NCQ mechanism."

But this article is rather old (March 2010) and I don't know if it has been solved.

  • 2
    This guy did a test of NCQ on SSDs in 2015 and concluded that they do in fact use NCQ, and that any setting below 8 can be detrimental to performance: https://strugglers.net/~andy/blog/2015/08/09/ssds-and-linux-native-command-queuing/ – RedScourge Jan 30 '20 at 04:44
0

From the Wikipedia article on NCQ:

NCQ can negatively interfere with the operating system's I/O scheduler, actually decreasing performance;[6] this has been observed in practice on Linux with RAID-5.[7] There is no mechanism in NCQ for the host to specify any sort of deadlines for an I/O, like how many times a request can be ignored in favor of others.

Mikael H
  • 4,868
  • 2
  • 8
  • 15