There are two kinds of SSD. Which one do I choose?
If you are a general consumer, you may be confused with SSD with a variety of M.2 interfaces in JD.COM and don’t know what to choose. Especially, some SSDs support SATA protocol, while others support NVME. Therefore, which is the best choice for consumers?
As an emerging technology, NVMe SSD with less latency is certainly faster than SATA SSD. Now SATA interface undoubtedly is the bottleneck of SSD speed. In this paper, we will introduce why NVMe is faster than SATA from the technical level, and give a directional guidance to the general consumers on how to choose a proper SSD.
Technical analysis
Let's take a look at the comparison between NVMe SSD and SATA SSD.
The M.2 SSD with SATA protocol will be connected to SATA port of Southbrige, on which traditional AHCI protocol stack (a subset of SCSI) will be used with long and high delay. AHCI has only one command queue with a queue depth of 32. If it needs to operate a large number of small file operations, congestion will occur.
NVMe SSD directly run PCIe channel and its protocol stack is very shallow. NVMe has 65535 queues, each with a depth of 65536 commands. NVMe also makes full use of 2048 interrupt vector of MSI, greatly reducing the latency. Especially for a large number of small files, NVMe SSD is significantly fast.
Then, let us analyze them from the prospective of protocol stack in operating system.
AHCI is still based on traditional block transmission, while NVMe uses a mechanism called "Doorbell" to take full advantage of extremely long queues, greatly reducing latency.
Data
Let's take a look at the specific data. First, let's see how NVMe reduces the time consumption of the protocol stack itself. We use Blktrace tool to analyze the time consumption and proportion of a set of data transmissions in the application layer, operating system layer, driver layer and hardware layer to learn from the performance differences between AHCI and NVMe protocols.
HDD as a reference standard has a very large latency up to 14 ms, while AHCI is 125 us and NVMe is 111us. As we can see from the figure, the proportion of time consumption of NVMe is less than that of AHCI, but the waiting time at application layer is very long. This is because physical hard disk such as SSD is not fast enough, resulting in application idle. NVMe leaves a wide space for a low-latency medium Optane hard disk, to improve its speed.
How about the actual use? Let's take MySQL database as an example.