Table of Contents
Fetching ...

FB$^+$-tree: A Memory-Optimized B$^+$-tree with Latch-Free Update

Yuan Chen, Ao Li, Wenhai Li, Lingfeng Deng

TL;DR

FB$^+$-tree introduces a memory-optimized B$^+$-tree variant that uses feature-based, byte-wise branch processing to exploit prefix skewness, blending trie-like locality with the balance of B$^+$-trees. It couples this with a highly optimized optimistic synchronization protocol that enables latch-free updates, using CAS and cross-node tracking to minimize contention. Empirical results show FB$^+$-tree delivers comparable point-lookups to state-of-the-art trie-based indexes while outperforming traditional B$^+$-trees by roughly two to four times under heavy multi-core workloads, and it demonstrates strong update and range-scan performance under contention. The combination of feature comparison and latch-free updates yields a versatile, scalable index suitable for main-memory databases and potentially extensible to other structures.

Abstract

B$^+$-trees are prevalent in traditional database systems due to their versatility and balanced structure. While binary search is typically utilized for branch operations, it may lead to inefficient cache utilization in main-memory scenarios. In contrast, trie-based index structures drive branch operations through prefix matching. While these structures generally produce fewer cache misses and are thus increasingly popular, they may underperform in range scans because of frequent pointer chasing. This paper proposes a new high-performance B$^+$-tree variant called \textbf{Feature B$^+$-tree (FB$^+$-tree)}. Similar to employing bit or byte for branch operation in tries, FB$^+$-tree progressively considers several bytes following the common prefix on each level of its inner nodes\textemdash referred to as features, which allows FB$^+$-tree to benefit from prefix skewness. FB$^+$-tree blurs the lines between B$^+$-trees and tries, while still retaining balance. In the best case, FB$^+$-tree almost becomes a trie, whereas in the worst case, it continues to function as a B$^+$-tree. Meanwhile, a crafted synchronization protocol that combines the link technique and optimistic lock is designed to support efficient concurrent index access. Distinctively, FB$^+$-tree leverages subtle atomic operations seamlessly coordinated with optimistic lock to facilitate latch-free updates, which can be easily extended to other structures. Intensive experiments on multiple workload-dataset combinations demonstrate that FB$^+$-tree shows comparable lookup performance to state-of-the-art trie-based indexes and outperforms popular B$^+$-trees by 2.3x$\ \sim\ $3.7x under 96 threads. FB$^+$-tree also exhibits significant potential on other workloads, especially update workloads under contention and scan workloads.

FB$^+$-tree: A Memory-Optimized B$^+$-tree with Latch-Free Update

TL;DR

FB-tree introduces a memory-optimized B-tree variant that uses feature-based, byte-wise branch processing to exploit prefix skewness, blending trie-like locality with the balance of B-trees. It couples this with a highly optimized optimistic synchronization protocol that enables latch-free updates, using CAS and cross-node tracking to minimize contention. Empirical results show FB-tree delivers comparable point-lookups to state-of-the-art trie-based indexes while outperforming traditional B-trees by roughly two to four times under heavy multi-core workloads, and it demonstrates strong update and range-scan performance under contention. The combination of feature comparison and latch-free updates yields a versatile, scalable index suitable for main-memory databases and potentially extensible to other structures.

Abstract

B-trees are prevalent in traditional database systems due to their versatility and balanced structure. While binary search is typically utilized for branch operations, it may lead to inefficient cache utilization in main-memory scenarios. In contrast, trie-based index structures drive branch operations through prefix matching. While these structures generally produce fewer cache misses and are thus increasingly popular, they may underperform in range scans because of frequent pointer chasing. This paper proposes a new high-performance B-tree variant called \textbf{Feature B-tree (FB-tree)}. Similar to employing bit or byte for branch operation in tries, FB-tree progressively considers several bytes following the common prefix on each level of its inner nodes\textemdash referred to as features, which allows FB-tree to benefit from prefix skewness. FB-tree blurs the lines between B-trees and tries, while still retaining balance. In the best case, FB-tree almost becomes a trie, whereas in the worst case, it continues to function as a B-tree. Meanwhile, a crafted synchronization protocol that combines the link technique and optimistic lock is designed to support efficient concurrent index access. Distinctively, FB-tree leverages subtle atomic operations seamlessly coordinated with optimistic lock to facilitate latch-free updates, which can be easily extended to other structures. Intensive experiments on multiple workload-dataset combinations demonstrate that FB-tree shows comparable lookup performance to state-of-the-art trie-based indexes and outperforms popular B-trees by 2.3x3.7x under 96 threads. FB-tree also exhibits significant potential on other workloads, especially update workloads under contention and scan workloads.

Paper Structure

This paper contains 27 sections, 17 figures, 2 tables.

Figures (17)

  • Figure 1: (a) Hardware statistics under uniform distribution, (b) Single-threaded throughput under different distributions.
  • Figure 2: (a) Multi-core scalability of B$^{link}$-tree, B$^+$-treeOLC, and FB$^+$-tree, (b) Access latency of memory hierarchies.
  • Figure 3: Illustration of a trie and the main idea of FB$^+$-tree
  • Figure 4: Binary search vs. FB$^+$-tree's branch algorithm.
  • Figure 5: Node structures of FB$^+$-tree.
  • ...and 12 more figures