一句话:提出惰性屏障 IO 栈 LazyBarrier,最小化屏障写命令,大幅提升 Android 多线程保序写性能。
同步写(fsync)是保证存储顺序的常用手段,但代价高昂;Android 默认采用 No-Barrier 来提升 fsync 性能。近期提出的 Barrier-Enabled IO Stack(BEIOS)利用屏障写命令(BWC)为闪存提供高效的保序机制,然而论文评估发现,在多线程场景下 BWC 数量随线程数线性增长,导致 BEIOS 性能下降。为此,作者提出 LazyBarrier,一个全新的保序 IO 栈,包含基于有限自动机、定义状态迁移的保序写(OPW)模型,最小化 BWC 的 Lazy Issue 惰性下发算法,支持 OPW 的修改版 F2FS,以及解决多队列块层顺序问题的 Barrier Scheduling。在 Android 智能手机上的实验表明,相比 BEIOS,LazyBarrier 在 FIO 基准和真实应用中分别将 OPW 性能提升 73% 与 29%;在服务器 dbench 负载下也比 BEIOS 高出 19%。
Costly synchronous write---a.k.a., fsync()---is a common approach to preserve the storage order of data. Android smart-phones use No-Barrier by default to improve fsync() performance. Recently, Barrier-Enabled IO Stack (BEIOS) provides an efficient order-preserving method for flash storage by barrier write commands (BWCs). However, our evaluation shows that BEIOS suffers from performance degradation in multi-threaded scenarios since BWCs increase linearly with the number of threads. This paper proposes LazyBarrier, a new order-preserving IO stack mainly involving order-preserving write (OPW) Model, the Lazy Issue algorithm, modified F2FS, and Barrier Scheduling. OPW Model is based on Finite Automata and defines state transition in OPW. Lazy Issue is a novel algorithm that minimizes BWCs. F2FS is modified to support OPW, and Barrier Scheduling solves the ordering problem in multi-queue block layer. The experiments on Android smartphones show that, compared with BEIOS, LazyBarrier improves OPW performance by 73% and 29% under the FIO benchmark and in real applications respectively. And LazyBarrier also outperforms BEIOS by 19% in dbench workload in servers.
@inproceedings{ZhangZCHPCP24,
title = {LazyBarrier: Reconstructing Android IO Stack for Barrier-Enabled Flash Storage},
author = {Yuanyi Zhang and Heng Zhang and Wenbin Cao and Xing He and Daejun Park and Jinyoung Choi and SungJun Park},
booktitle = {ASPLOS},
year = {2024},
doi = {10.1145/3620665.3640370}
}