,

Contents · Storage interfaces (SATA, NVMe), controllers


Physical links and form factors

  • Form factors: 2.5" SATA, M.2 (B/M key), U.2/U.3, EDSFF (E1.S/E3), Add-in Cards (AIC).
  • Links: SATA (6 Gb/s), PCIe (Gen3/4/5, x1..x16); PCIe lanes dictate peak bandwidth.
  • HBAs/RAID cards aggregate drives; power-loss protection matters for data integrity.

SATA/AHCI overview

  • AHCI defines registers and command list processing; optimized for HDD semantics.
  • NCQ (Native Command Queuing) improves concurrency but limited queue depth (32).
  • SATA bottlenecks SSDs due to link and protocol overhead.

NVMe over PCIe

  • Designed for SSDs: parallel queues, doorbells, minimal register access.
  • Admin and I/O queue pairs per CPU core; MSI-X interrupts enable scaling.
  • NVMe over Fabrics (NVMe-oF): RDMA/TCP transports for disaggregated storage.
Doorbell write → device processes SQ entries → CQ entry + interrupt

Submission/completion queues and interrupts

  • Each I/O queue is a circular buffer in memory; host writes SQ entries, device writes CQs.
  • Queue depth and interrupt coalescing balance latency vs throughput.
  • Polling (io_uring, SPDK) reduces latency by avoiding interrupt overheads.
// io_uring submission sketch
io_uring_sqe* sqe = io_uring_get_sqe(&ring);
io_uring_prep_read(sqe, fd, buf, len, off);
io_uring_submit(&ring);

Namespaces, multipath, features

  • Namespaces partition capacity; ANA/MPIO support multipath and failover.
  • Features: encryption, sanitize/secure erase, firmware updates, telemetry.
  • SMART/health monitoring predicts endurance and failure.

Controller internals and firmware

  • FTL maps LBAs to flash pages; wear leveling and garbage collection maintain performance.
  • Write amplification impacts endurance; OP (over-provisioning) mitigates.
  • DRAM-less controllers use HMB; PLP (caps) protect metadata on power loss.

Filesystems and block layers

  • IO stack: VFS → filesystem → block layer → driver → device; merge and scheduler policies matter.
  • Modern filesystems (ext4, XFS, APFS, Btrfs, ZFS) exploit SSD parallelism differently.
  • Userspace stacks (SPDK) bypass kernel for ultra-low latency.

Performance: latency, IOPS, throughput

  • IOPS bound by queue depth and controller; throughput by lanes × rate × efficiency.
  • Workload mix (read/write, seq/random) changes optimal tuning (QD, coalescing, polling).
  • Measure with fio; watch tail latency (p99/p999) and thermal throttling.
fio --name=randread --filename=/dev/nvme0n1 --ioengine=io_uring --iodepth=64 --bs=4k --rw=randread --numjobs=4

Exercises

  1. Compare SATA SSD vs NVMe SSD latency and throughput with fio; chart QD scaling.
  2. Enable polling (io_uring) and measure latency improvements vs interrupt mode.
  3. Simulate endurance impact by varying write amplification in an SSD model.
NVMe unlocks SSD parallelism via queues and doorbells; tune queue depth, interrupts, and the IO stack for your workload.