Jump to content

Native Command Queuing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 187.241.105.90 (talk) at 21:16, 18 February 2019 (History: blaalavmasñffasdf). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
NCQ allows the drive itself to determine the optimal order in which to retrieve outstanding requests. This may, as here, allow the drive to fulfill all requests in fewer rotations and thus less time.

In computing, Native Command Queuing (NCQ) is an extension of the Serial ATA protocol allowing hard disk drives to internally optimize the order in which received read and write commands are executed. This can reduce the amount of unnecessary drive head movement, resulting in increased performance (and slightly decreased wear of the drive) for workloads where multiple simultaneous read/write requests are outstanding, most often occurring in server-type applications.

History

Many newer chipsets support the Advanced Host Controller Interface

Hard disk drives

Performance

A 2004 test with the first-generation NCQ drive (Seagate 7200.7 NCQ) found that while NCQ increased IOMeter performance, desktop application performance actually decreased.[1] One review in 2010 found improvements on the order of 9% (on average) with NCQ enabled in a series of Windows multitasking tests.[2]

NCQ can negatively interfere with the operating system's I/O scheduler, actually decreasing performance;[3] this has been observed in practice on Linux with RAID-5.[4] 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. In theory, a queued request can be delayed by the drive an arbitrary amount of time while it is serving other (possibly new) requests under I/O pressure.[3] Since the algorithms used inside drives' firmware for NCQ dispatch ordering are generally not publicly known, this introduces another level of uncertainty for hardware/firmware performance. Tests at Google around 2008 have shown that NCQ can delay an I/O for up to 1-2 seconds. A proposed workaround is for the operating system to artificially starve the NCQ queue sooner in order to satisfy low-latency applications in a timely manner.[5]

On some drives' firmware, such as the WD Raptor circa 2007, read-ahead is disabled when NCQ is enabled, resulting in slower sequential performance.[6]

Safety (FUA)

One lesser-known feature of NCQ is that, unlike its ATA TCQ predecessor, it allows the host to specify whether it wants to be notified when the data reaches the disk's platters, or when it reaches the disk's buffer (on-board cache). Assuming a correct hardware implementation, this feature allows data consistency to be guaranteed when the disk's on-board cache is used in conjunction with system calls like fsync.[7] The associated write flag, which is also borrowed from SCSI, is called Force Unit Access (FUA).[8][9][10]

Solid-state drives

NCQ is also used in newer solid-state drives where the drive encounters latency on the host, rather than the other way around. For example, Intel's X25-E Extreme solid-state drive uses NCQ to ensure that the drive has commands to process while the host system is busy processing CPU tasks.[11]

NCQ also enables the SSD controller to complete commands concurrently (or partly concurrently, for example using pipelines) where the internal organisation of the device enables such processing.

The NVM Express (NVMe) standard also supports command queuing, in a form optimized for SSDs.[12] NVMe allows multiple queues for a single controller and device, allowing at the same time much higher depths for each queue, which more closely matches how the underlying SSD hardware works.[13]

See also

References

  1. ^ "Seagate's Barracuda 7200.7 NCQ hard drive - The Tech Report - Page 13". The Tech Report. Retrieved 2014-01-11.
  2. ^ "Multitasking with Native Command Queuing - The Tech Report - Page 5". The Tech Report. Retrieved 2014-01-11.
  3. ^ a b Yu, Y. J.; Shin, D. I.; Eom, H.; Yeom, H. Y. (2010). "NCQ vs. I/O scheduler". ACM Transactions on Storage. 6: 1. doi:10.1145/1714454.1714456. [1]
  4. ^ "hard drive - Poor Linux software RAID 5 performance with NCQ". Server Fault. Retrieved 2014-01-11.
  5. ^ Gwendal Grignou, NCQ Emulation, FLS'08 talk summary (p. 109) slides
  6. ^ "Mark Lord: Re: Lower HD transfer rate with NCQ enabled?". LKML. 2007-04-03. Retrieved 2014-01-11.
  7. ^ Marshall Kirk McKusick. "Disks from the Perspective of a File System - ACM Queue". Queue.acm.org. Retrieved 2014-01-11.
  8. ^ Gregory Smith (2010). PostgreSQL 9.0: High Performance. Packt Publishing Ltd. p. 78. ISBN 978-1-84951-031-8.
  9. ^ http://www.seagate.com/docs/pdf/whitepaper/D2c_tech_paper_intc-stx_sata_ncq.pdf
  10. ^ Jonathan Corbet (2010-08-18). "The end of block barriers". LWN.net. Retrieved 2015-06-27.
  11. ^ Gasior, Geoff (November 23, 2008). "Intel's X25-E Extreme solid-state drive - Now with single-level cell flash memory". Tech Report.
  12. ^ Dave Landsman (2013-08-09). "AHCI and NVMe as Interfaces for SATA Express Devices – Overview" (PDF). SATA-IO. Retrieved 2013-10-02.
  13. ^ "NVM Express Overview". nvmexpress.org. Retrieved 2014-11-26.