Abstract
Non-blocking search data structures offer scalability with a progress guarantee on high-performance multi-core architectures. In the recent past, "learned queries" have gained remarkable attention. It refers to predicting the rank of a key computed by machine learning models trained to infer the cumulative distribution function of an ordered dataset. A line of works exhibits the superiority of learned queries over classical query algorithms. Yet, to our knowledge, no existing non-blocking search data structure employs them. In this paper, we introduce Kanva, a framework for learned non-blocking search. Kanva has an intuitive yet non-trivial design: traverse down a shallow hierarchy of lightweight linear models to reach the "non-blocking bins," which are dynamic ordered search structures. The proposed approach significantly outperforms the current state-of-the-art -- non-blocking interpolation search trees and elimination (a,b) trees -- in many workload and data distributions. Kanva is provably linearizable.
Introduction
In the landscape of high-performance computing, traditional ordered search structures like B+ trees and Binary Search Trees are hitting a "scalability wall." In multi-core environments, managing these structures concurrently typically requires locks, which introduce bottlenecks, deadlocks, and priority inversion. While lock-free (non-blocking) alternatives exist, they are often burdened by high overhead due to complex rebalancing logic and deep pointer-chasing traversals.
Simultaneously, the field of "Learned Indexes" has emerged, utilizing machine learning models to approximate data distributions and predict key locations. However, existing learned indexes have largely been static, lock-based, or unable to provide linearizability—the gold standard of consistency where every operation appears instantaneous. Kanva addresses these gaps by being the first framework to combine learned indexing with lock-free, linearizable operations.
The Kanva Architecture
Kanva replaces deep $O(\log n)$ tree traversals with a shallow hierarchy of lightweight linear models. The design is centered around a flat structure that minimizes cache misses and memory lookups.
As shown in Figure 1, the root and internal nodes contain simple linear regression models ($rank = a \times key + b + \epsilon$). These models predict which "bin" a key belongs to. At the leaves of this shallow tree are the non-blocking bins—dynamic, ordered structures that handle the actual data storage. This approach allows the CPU to avoid the overhead of deep tree traversals, significantly improving cache efficiency.
Handling Dynamic Updates and Retraining
A core innovation of Kanva is its ability to handle dynamic updates without sacrificing its lock-free nature. When a bin grows beyond a certain threshold, Kanva triggers a retraining process to transform the bin into a new internal node with its own model.
This transformation, illustrated in Figure 4, utilizes a "helping" paradigm. If a thread encounters a bin undergoing transformation, it does not wait; instead, it cooperatively helps complete the retraining using a one-pass, lock-free regression algorithm. This ensures that the system maintains progress even under high contention.
Consistency and Search Efficiency
To ensure linearizability, Kanva employs a versioning system for range queries. By associating values with timestamps, Kanva can capture a "logical snapshot" of the data without using locks. For the "last mile" of finding a key within a predicted range, Kanva utilizes exponential search. This method is more robust to prediction errors in concurrent settings than standard binary search, providing a reliable path to the target data.
Performance Evaluation
The researchers evaluated Kanva against a 200-million-key dataset across various real-world and synthetic distributions, including Amazon sales data, Facebook user IDs, and Wikipedia timestamps. Key results include:
- Massive Speedups: Kanva outperforms the state-of-the-art lock-free Interpolation Search Tree (C-IST) by up to 100x across diverse workloads.
- Superior Scalability: In high-contention scenarios (up to 128 threads), Kanva significantly outperforms lock-based learned indexes like FINEdex by eliminating lock-release wait times.
- Cache Efficiency: Kanva demonstrated significantly fewer Last Level Cache (LLC) misses compared to traditional trees, validating the benefits of its shallow architecture.
Conclusion
Kanva demonstrates that learned indexes can be both fast and strictly consistent. By combining lightweight models with a lock-free helping paradigm and versioning, it sets a new standard for scalable search structures. As multi-core counts continue to rise, Kanva suggests that the future of high-performance data structures lies in being data-aware and non-blocking.
Summary updated