Why NVMe is Better Than ATA

m2-connectornvmepci-expressssd

SATA M.2 SSDs use SATA on the physical layer and ATA as software protocol for data transmission.

NVMe M.2 SSDs use PCIe on the physical layer and NVMe as software protocol for data transmission.

I was told that in this question.

Of course PCIe is faster than SATA so NVMe SSDs have a higher speed.

But why does it require a new software protocol? Why can't we have PCIe M.2 SSDs talking ATA? (*)

I think the higher speed comes from PCIe and not from the NVMe protocol. Why do we need NVMe?

(*) I think AHCI wouldn't be necessary as the SSD can be addressed by its PCI address. Also ATA can transmit meta data like the disk size.

Best Answer

While I can't find the references anymore, the one specific difference I remember is that NVMe was designed to be highly parallel. I might be misremembering this, but:

  • ATA via legacy IDE had no support for parallel commands at all.

  • ATA via AHCI supports NCQ which allows up to 32 commands to be issued (which may return data in any order), although not all commands are "queue-able". SCSI also supports "tagged queuing" which allows up to 16 commands to be issued.

    If I understand correctly, this means that with a solid-state disk (with no "seek time"), such numbers are low enough that even a max-size queue is processed instantly and the disk returns to doing nothing until the host notices and issues more requests.

  • NVMe, on the other hand, was designed to allow up to 64,000 queued commands, allowing the SSD to remain continuously busy if needed.

A similar comparison may be found at Phison (an SSD controller manufacturer)'s blog, specifically this table, which says:

  • AHCI only supports a single command queue; NVMe supports multiple queues in parallel.
  • AHCI uses a single interrupt for all ports connected to the same controller; NVMe allows multiple interrupts.
  • As I understand it, this implies that a single CPU core must handle all I/O from/to all disks attached to an AHCI controller, whereas NVMe allows different cores to simultaneously read or write data. (But perhaps it also helps that most NVMe disks bring their own controllers while the AHCI controller is usually one per system, or rarely two.)

See also:

Why can't we have PCIe M.2 SSDs talking ATA? (*)

(*) I think AHCI wouldn't be necessary as the SSD can be addressed by its PCI address.

Even if the SSD brings its own controller (which some early pre-NVMe SSDs actually did!), you still need something like AHCI, as it defines how the disk needs to be accessed by its PCI address and so on. AHCI already has nothing to do with obtaining disk-specific information – that's always done through ATA "IDENTIFY DEVICE" and similar commands. But there needs to be an agreement on how to submit those commands to the disk and how to receive responses (in particular things like DMA and queues) – that's what AHCI is about.

Of course, the SSDs could use ATA with something else than AHCI, as long as the OS had the corresponding drivers (just like many did before AHCI existed), but eventually such "nonstandard" devices would converge towards a new standard protocol, whether it is named NVMe or otherwise.

(Though ATA can already be used without AHCI either via legacy PCI IDE interface, or over the network such as AoE (ATA over Ethernet), but it's not as popular as SCSI for such uses – which can also be used over different transports like SAS, FireWire, Infiniband, and iSCSI; and finally NVMe can be used over network using NVMe-oF.)

Related Question