Kernel-Bypass I/O
AdvancedAdvanced

Kernel-Bypass I/O

Keywords

kernel bypassSPDKuser-space driverpolling modethread-to-queue affinityDPDKlockless designAsk ChatGPT

Progress

Sign in to track your progress.

即使有了 io_uring,I/O 路徑仍然要經過 kernel 的 block layer 和 file system,這些軟體層在 NVMe SSD 延遲降到微秒等級後,已經成為不可忽視的瓶頸。 今天的課程分為兩大階段。第一階段我們要徹底檢視 Linux kernel 的 I/O stack,看看在高速 SSD 時代,kernel 原本提供的 I/O scheduling、page cache、cgroup 隔離等機制哪些已經成為效能瓶頸,接著深入介紹 SPDK 這個 kernel bypass 框架如何透過 user space driver、polling mode 與 share-nothing 架構來榨乾 NVMe SSD 的極限效能,同時也會探討 eBPF/XRP 與 xNVMe 這些不需要完全繞過 kernel 的中間路線方案。

第二階段我們要探討 host 與 device 之間的控制權分配,以 CSAL 為 case study,了解如何用高速 SSD 搭配大容量 QLC SSD 的雙層架構來實現 write shaping、降低 write amplification,並透過 TCO 經濟學分析說明為什麼 QLC 正在取代 HDD。

Pro Tip: 開啟 YouTube 中文字幕。

2026/03/22 勘誤:CSAL 全名為 Cloud Storage Abstraction Layer 而非 Computational Storage Abstraction Layer (謝謝李侑聲同學)

貢獻 HackMD 共筆

Key Concepts

我理解 kernel 為 HDD 時代設計的三項優化在 SSD 時代的取捨:I/O scheduling, I/O merging, interrupt v.s polling

我理解 SPDK 的完整 I/O 流程:透過 hugepage DMA buffer 與 MMIO doorbell register,在 user space 直接操作 NVMe 的 submission/completion queue,由 polling thread 偵測 completion,全程無 syscall、interrupt 或 context switch

我了解 kernel bypass 犧牲的三大類服務:security/isolation、fairness/sharing、POSIX ecosystem

我理解 eBPF/XRP 的中間路線

我理解 kernel bypass 不只為效能,更為 controllability:application 可控制 data placement、降低 write amplification

我能描述 CSAL 雙層架構:高速 SSD 以 log-structured 方式吸收 random write,經 compaction 以 sequential I/O 寫入 QLC SSD

我理解 CSAL 的兩階層 host-side FTL

Recommended Resources

Porting SPDK to PostgreSQL? (2021):

More important for PostgreSQL is whether something like this can be incorporated without changing the overall architecture: If you just have to change a handful of functions performing low-level I/O, it may be worthwhile even if only a few systems (Linux systems where the DBA is willing to set up devices for direct access from user space) benefit from it. If it means rewriting large parts of postgres and then some platforms cannot be supported at all or only at reduced performance, this is not an option.

KONE Destination 電梯排程

Test Your Understanding