
892
软件学报 2022 年第 33 卷第 3 期
include: a data space distribution strategy and distributed access model across NUMA nodes are proposed under a DRAM+PM hybrid
memory architecture, which realizes the efficient use of PM data space; aiming at the high latency problem of accessing PM across
NUMA nodes, an I/O proxy routines access method is proposed, which converts the overhead of accessing PM across NUMA into the
overhead of a remote DRAM memory copy and local access to PM. The Cache Line Area cache page mechanism is designed to alleviate
the problem of I/O write amplification and improve the efficiency of local access to PM. The concept of traditional table space is ex tended,
so that each table space has both independent table data storage and dedicated WAL (write-ahead logging) storage. For the distributed
WAL storage architecture, a transaction processing mechanism based on global sequence numbers is proposed, which addresses the
problem of single-point the WAL performance bottleneck, and implement NUMA-aware transaction processing, checkpoint and disaster
recovery optimization mechanisms and algorithms. Experimental results show that the method proposed in this study can effectively
improve the performance of the PM storage engine under the NUMA architecture, by 105%−317% in v arious test scenarios of YCSB and
90%−134% in TPC-C.
Key words: database; storage engine; persist memory; NUMA (non uniform memory access); WAL (writ e-ahead logging)
数据库是高效组织、存储、管理数据的软件. 随着互联网、物联网和移动计算技术的发展, 人们能够获
取的数据规模爆炸式增长. 如何高效地存储、管理和查询这些海量多模的数据, 是当前数据管理领域面临的
严峻挑战. 近年来, 新型硬件技术突飞猛进, 特别是非易失性内存(non-volatile memory, NVM)的出现, 打破了
传统内外存之间的界限, 对现有的软件体系结构带来了颠覆性的影响. 传统的数据库系统是基于慢速块存储
设备构建的, 采用了经典的“高速缓存+内存+磁盘”三层存储架构设计, 由于磁盘和内存的硬件延迟相差两个
数量级, 导致数据在内存和外存之间移动或交换时会引发系统性能颠簸的问题. 计算机硬件的创新为数据库
系统带来了全新的机会, 数据库系统需要根据新型硬件特性重新优化设计软件的架构和算法.
非易失性内存也称为持久内存(persistent memory, PM)或存储级内存(storage-class memory, SCM), PM 具
有非易失性、字节寻址、低时延、大容量等优势, 但是当前的 PM 硬件也存在着磨损不均衡、读写不对称等
问题
[1]
. 文献[2]给出了英特尔®傲腾™ DC 持久内存(DCPMM)和 DRAM 的时延和带宽对比, 其中, DCPMM 的
读写时延约是 DRAM 的 4 倍, 说明 PM 的读写能力较 DRAM 还有一定的差距; DCPMM 的读带宽是其写带宽
的 10 倍以上,即存在巨大的读写非对称性. 因此, 业界普遍认为, PM 短期内还无法完全替代 DRAM, 采用
DRAM+P M 的混合内存架构更能发挥各自的优势
[3]
.
近年来, 一些先进的商业数据库已开始尝试应用 PM 来提升性能. Oracle 20c 增加了 PM Database
[4]
功能,
使数据库绕过 DRAM Bu ffer, 直接读取 PM 上的数据, 并能跟踪数据访问频率, 自动将热点数据从 PM 中调入
DRAM. SQL Se rver 2019 则增加了混合缓冲池, 使缓冲池对象能够直接引用 PM 设备上的数据页. 尽管这些商
业数据库推出了 PM 数据库功能, 但大多处于初级的 DAX (direct access)
[5]
接口适配阶段, 并未针对 PM 新特
性对数据库系统做深度优化.
NUMA (non uniform memory access)架构将内存和处理器分成组, 每组称为一个 NUM A 节点, 从任一个
处理器角度看, 与该处理器位于同一 NUMA 节点中的内存称为本地, 其他 NUMA 节点中的内存称为远端,
CPU 访问本地内存的速度远高于远端内存, 并且节点之间的距离越大, 访问时延越高
[6]
. PM 作为内存使用时
同样存在这个问题, 而且与 DR A M 相比, CPU 跨 NUMA 节点访问 PM 的性能衰减更加明显
[7]
. 因此, 构建 PM
存储引擎时, 需要把 NUMA 特性作为重要的设计考量, 确保合理使用 PM 数据存储空间的同时, 降低跨
NUMA 节点访问 PM 的开销.
本文探讨了中兴通讯新一代数据库系统 GoldenX 的 PM 存储引擎设计实践, 重点研究了 NUMA 感知的
PM 存储引擎下的数据空间分布、事务处理和异常恢复等问题. 本文主要工作和贡献如下:(1) 提出了一种
DRAM+P M 混合内存架构下跨 NUMA 节点的数据空间分布策略和分布式存取模型, 实现了 PM 数据空间的高
效使用. (2) 针对跨 NUMA 访问 PM 的高开销问题, 提出了 I/O 代理例程访问方法, 将跨 NUMA 访问 PM 开销
转化为一次远程 DRAM 内存拷贝和本地访问 PM 的开销; 设计了 CLA 缓存页机制, 缓解 I/O 写放大问题, 提
升了本地访问 PM 的效率. (3) 扩展了传统的表空间概念, 让每个表空间既拥有独立的表数据存储, 也拥有专
门的 WA L 日志存储. 针对该分布式 WAL 存储架构提出一种基于全局顺序号的分布式 WAL 事务处理机制, 解
评论