Saturday, September 3, 2016

SSD - Upgrade from AHCI to NVMe to Extract Gains From Flash

On my Macbook Air, the built in SSD flash drive uses the AHCI protocol, not the more advanced NVMe protocol that was designed for SSD flash drive. Why did Apple do this? Traditional computer systems read and write data to hard disk drives (HDD) using ATA or Advanced Host Controller Interface (AHCI) protocol. AHCI was designed for the physical behavior of a HDD - need time to spool up the platter, to find the first valid data on the platter, need time go to another place on the platter if the data is not stored contiguously on the platter.

But with the advent of solid state drives (SSD), the original ways of talking to storage using AHCI is outmoded.  That's why a new interface, designed for SSD, is needed. That is called Non Volatile Memory Express (NVMe).   It eliminates the overhead of the older protocol  - spooling up a platter, find first valid data on a platter - and  focuses on the strengths of SSD through lower latency and higher throughput.

There is also the PHYSICAL connection to consider. The traditional IDE/SATA/SATA Express physical connector interface is now replaced by PCIe.

Even with storage upgrades (HDD to SSD), other upgrades are needed as well. First, upgrade the HW interface (SATA->PCIe). Next, upgrade the SW interfaces (AHCI -> NVMe). Early Apple MacBooks had SSD drives, had PCIe interfaces, but didn't support NVMe yet.


 

In the world of high-speed storage, the conversation has shifted from hard disk drives (HDDs) versus solid-state drives (SSDs) to the protocols that govern them. When it comes to SSDs running on the PCIe interface, two acronyms dominate the discussion: NVMe and AHCI. While both serve as communication protocols between the storage device and the rest of your computer, they are far from equal. Think of it as the difference between a winding country road and a multi-lane superhighway – both get you to your destination, but one is significantly faster and more efficient.

This blog post will delve into the key differences between NVMe and AHCI, exploring why NVMe has become the undisputed champion for PCIe SSDs.

A Tale of Two Protocols: Understanding the Basics

At its core, the protocol determines how your SSD communicates with your computer's CPU. This "language" dictates the speed and efficiency of data transfer.

AHCI (Advanced Host Controller Interface) was developed in 2004, a time when HDDs with their spinning platters were the primary form of storage. It was a significant improvement over its predecessor, IDE, but its design is fundamentally rooted in the mechanics of traditional hard drives.

NVMe (Non-Volatile Memory Express), on the other hand, was designed from the ground up for flash-based storage like SSDs. Introduced in 2011, it was created to take full advantage of the low latency and high parallelism of modern solid-state technology.

The key takeaway here is the design philosophy: AHCI was built for spinning disks, while NVMe was tailor-made for the flash memory in your SSD.

The Performance Gap: Why NVMe Reigns Supreme

The architectural differences between NVMe and AHCI translate into a significant performance disparity, especially on the high-bandwidth PCIe interface. Here's a breakdown of the key areas where NVMe excels:

Command Queuing and Depth

This is arguably the most significant advantage of NVMe. Imagine a single-lane road versus a massive highway.

    AHCI: Supports only one command queue with a depth of up to 32 commands. This means it can only handle a limited number of data requests at a time, creating a bottleneck.

    NVMe: Blows AHCI out of the water with support for up to 65,536 command queues, each with a queue depth of up to 65,536 commands. This massive parallelism allows for a far greater number of simultaneous read and write operations, leading to dramatically higher IOPS (Input/Output Operations Per Second).

Latency

Latency is the delay before a transfer of data begins. Lower latency means a more responsive system.

    AHCI: Has a latency of around 6 microseconds. This is due to a more complex communication path that involves more register reads.

    NVMe: Boasts a much lower latency of approximately 2.8 microseconds. This is because it communicates more directly with the CPU, streamlining the data transfer process.

Direct Communication with the CPU

    AHCI: Data has to pass through a SATA controller before reaching the CPU, adding an extra step and increasing latency.

    NVMe: On a PCIe SSD, NVMe communicates directly with the CPU, eliminating the middleman and further reducing latency and improving efficiency.

Real-World Impact: What Does This Mean for You?

These technical advantages translate into tangible benefits for the end-user:

    Blazing Fast Speeds: NVMe SSDs can achieve read and write speeds that are multiples of their AHCI counterparts. While a SATA SSD using AHCI tops out at around 550 MB/s, a high-end NVMe SSD can easily surpass 7,000 MB/s.

    Quicker Boot Times: While both AHCI and NVMe SSDs offer a massive improvement over HDDs, NVMe can shave off a few more precious seconds from your system's startup time.

    Faster Application and Game Loading: For gamers and professionals working with large files (video editors, 3D artists, etc.), the difference is night and day. Games and applications load significantly faster, and large files are transferred in a fraction of the time.

    Improved Multitasking: The superior command queuing of NVMe makes for a much smoother experience when running multiple applications simultaneously.

Is AHCI Still Relevant for PCIe SSDs?

While NVMe is the clear winner, some older motherboards with M.2 slots might only support AHCI over PCIe. In such cases, you can still use a PCIe SSD, but you'll be leaving a significant amount of performance on the table. It's like putting a sports car engine in a family sedan – you won't be able to utilize its full potential.

The Verdict: NVMe is the Clear Choice

For anyone building a new PC or upgrading their storage, the choice is clear. If your motherboard supports it, an NVMe SSD is the way to go. The performance benefits over an AHCI-based drive are substantial and will result in a faster, more responsive, and more enjoyable computing experience. AHCI served its purpose well in the era of mechanical hard drives, but for the lightning-fast world of PCIe SSDs, NVMe is the undisputed king.Here you can see that a SW protocol can be mated with different HW protocol. For example, PCIe can support both AHCI and NVMe. On some of the Macbook Airs that I have used, the SSD is already connected to the SSD, but it is still using the older AHCI SW protocol. Apple has started to updated MacOS to support NVMe in the high end Macbooks. Hope to see this in Macbook Airs soon!

No comments :

Post a Comment