APEX: A High-Performance Learned Index on Persistent Memory

Baotong Lu, Jialin Ding, Eric Lo, Umar Farooq Minhas, Tianzheng Wang

Abstract

APEX is a persistent memory (PM) optimized learned index designed to bring the efficiency of machine learning-based indexing to non-volatile memory architectures. By addressing the critical issues of write amplification and crash consistency, APEX achieves up to 15x higher throughput than existing PM B-trees. It introduces a novel "probe-and-stash" technique and leverages DRAM-resident metadata to minimize expensive PM operations, ensuring both high performance and near-instant crash recovery.

The Challenge: Adapting Learned Indexes for PM

Byte-addressable Persistent Memory (PM), such as Intel Optane, provides a unique tier between DRAM and traditional storage. While it offers persistence at memory speeds, it suffers from asymmetric bandwidth, where writes are significantly slower than reads.

Existing learned indexes, like ALEX, use lightweight models to predict data locations within an array. However, they were designed for DRAM and perform poorly on PM for two main reasons:

  1. Write Amplification: Maintaining sorted order requires frequent record shifting, which saturates PM write bandwidth.
  2. Crash Consistency: Standard implementations lack the necessary guarantees to survive power failures without significant performance penalties from traditional logging libraries.

The APEX Architecture

APEX modifies the learned index paradigm to respect the hardware characteristics of PM. It builds upon the concept of using models to approximate the Cumulative Distribution Function (CDF) of keys to determine their storage locations.

The hierarchical structure of a learned index, where models at each level predict the position of keys within data nodes.

Key Innovations

To overcome PM's limitations, APEX implements several architectural optimizations:

  • Probe-and-Stash: Instead of shifting records to accommodate new inserts, APEX treats the model's prediction as an order-preserving hash. It attempts to place records in a Primary Array (PA); if the target slot is occupied, it uses linear probing or redirects the record to a Stash Array (SA). This eliminates data shifting and drastically reduces PM writes.
  • DRAM Accelerators: APEX maintains small metadata structures in DRAM, including 1-byte key fingerprints and bitmaps. These allow the system to verify key existence or locate free slots without issuing expensive PM reads.
  • Hybrid Logging for Consistency: For Structural Modification Operations (SMOs) like node splitting, APEX uses a lightweight mix of logical undo and redo logging, requiring only a few cacheline writes to PM.
The APEX node layout, illustrating the separation between DRAM-resident accelerators and PM-resident data structures like the Primary and Stash arrays.

Performance and Evaluation

APEX was evaluated against state-of-the-art PM indexes (e.g., BzTree, LB+Tree) using a variety of synthetic and real-world datasets, including OSM Longitudes and Facebook user IDs.

  • Throughput: APEX outperformed competitors by up to 15x for inserts and 7.1x for searches on standard datasets. Even on highly non-linear "worst-case" data, it maintained a significant lead in search performance.
  • Recovery Time: Thanks to its lazy rebuilding strategy for DRAM structures, APEX achieves near-instant recovery times of approximately 42 milliseconds.
  • Scalability: The index demonstrates near-linear scalability across multiple threads, validating its efficient concurrency control protocols.

Conclusion

APEX demonstrates that learned indexes can be highly effective on persistent memory when designed with hardware constraints in mind. By shifting the perspective of models from simple predictors to order-preserving hash functions and utilizing DRAM for metadata acceleration, APEX provides a robust, high-performance indexing solution for the next generation of memory-centric systems.

Summary updated

BibTeX
@article{lu2021apex,
  author = {Baotong Lu and Jialin Ding and Eric Lo and Umar Farooq Minhas and Tianzheng Wang},
  title = {{APEX: A High-Performance Learned Index on Persistent Memory}},
  journal = {Proc. VLDB Endow.},
  year = {2021},
  doi = {10.14778/3494124.3494141},
}
Figure