Parallel Batch-Dynamic kd-Trees

Rahul Yesantharao, Yiqiu Wang, Laxman Dhulipala, Julian Shun

Introduction

The $kd$-tree is a fundamental tool for spatial search, but it has historically struggled with dynamic updates. Traditional implementations face a difficult trade-off: either perform full rebuilds to maintain balance (slow updates) or use lazy insertions/tombstones (slow queries due to tree skew). In modern applications like real-time sensor monitoring, data arrives in large parallel batches, requiring a structure that can handle high-throughput updates without sacrificing query efficiency.

The BDL-Tree Architecture

The authors introduce the BDL-tree (Batch-dynamic Log-structured $kd$-tree), which adapts the "log-structured" design commonly found in NoSQL databases (like LSM-trees) for spatial data. Instead of maintaining one giant tree, the BDL-tree organizes data into a set of exponentially growing static $kd$-trees ($2^0, 2^1, 2^2, \dots$).

The BDL-tree architecture, featuring a buffer and exponentially growing static trees.

Cascading Merges and Deletions

When a new batch of points arrives, it fills a small buffer. Once full, it "cascades" up, merging smaller trees into the first available empty "slot" to form a larger, perfectly balanced tree. To handle deletions efficiently, each sub-tree has an associated parallel Bloom filter. This allows the system to quickly skip trees that definitely do not contain a specific point, avoiding expensive spatial traversals.

Parallelism and Cache-Obliviousness

A key innovation of the BDL-tree is the use of a van Emde Boas (vEB) layout for its underlying static trees. This cache-oblivious memory arrangement improves search speed by keeping parent and child nodes physically close in memory.

Parallel recursive construction strategy for the van Emde Boas (vEB) layout.

By treating sub-trees as static components that are only ever rebuilt rather than modified in place, the BDL-tree gains the performance benefits of vEB layouts without the typical implementation complexity. The authors developed a parallel algorithm to construct this layout, utilizing parallel median partitioning and prefix sums to reduce the parallel time of a batch update to $O(\log n \log \log n)$.

Evaluation and Key Results

The BDL-tree was evaluated on a 36-core machine using synthetic and massive real-world datasets, including a 321-million-point astronomy dataset.

  • Scalability: The structure achieved up to 34.8x self-relative speedup for batch insertions and 46.1x for $k$-NN queries.
  • Throughput: It handled up to 14.5 million updates and 6.7 million $k$-NN queries per second.
  • Robustness: In mixed workloads with interleaved inserts, deletes, and queries, the BDL-tree significantly outperformed both "Full Rebuild" and "Tombstone" baselines.

Conclusion and Future Work

The BDL-tree occupies a "Goldilocks" sweet spot between static and skewed dynamic trees, maintaining balance through periodic logarithmic rebuilds. While it performs exceptionally well in low-to-medium dimensions, it still faces the "curse of dimensionality" in very high-dimensional spaces (e.g., 16D). Future research may explore integrating Morton-based optimizations or leaf-based search strategies to further enhance performance.

Summary updated

BibTeX
@misc{yesantharao2021parallel,
  author = {Rahul Yesantharao and Yiqiu Wang and Laxman Dhulipala and Julian Shun},
  title = {{Parallel Batch-Dynamic kd-Trees}},
  year = {2021},
  eprint = {2112.06188},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.06188},
}
Figure