Abstract
Efficiently joining high-velocity data streams using sliding windows is a critical challenge in modern stream processing. Traditional indexing structures, such as B+-Trees, struggle with the massive update overhead and synchronization bottlenecks inherent in multicore environments. This paper presents the Partitioned In-memory Merge-Tree (PIM-Tree), a novel indexing structure that decouples mutable and immutable components to balance update efficiency with search performance. Combined with an asynchronous parallel join algorithm, the PIM-Tree achieves significant throughput gains, providing up to a 5.5x speedup on an 8-core CPU and outperforming state-of-the-art concurrent indexes like the Bw-Tree by 2.6x.
Introduction
Stream processing systems analyze continuous data flows using "sliding windows"—temporal or count-based subsets of data (e.g., the last 10,000 events). To perform complex operations like joins at line rate, these windows must be indexed. However, the high dynamicism of streaming data, where tuples constantly arrive and expire, creates a heavy update burden that traditional database indexes are not designed to handle.
Conventional indexes like B+-Trees often become bottlenecks in multithreaded environments due to heavy locking mechanisms. This paper introduces the PIM-Tree, a two-stage index data structure, and a complementary parallel algorithm designed to exploit modern multicore processors effectively.
The PIM-Tree Architecture
The PIM-Tree balances fast insertions with high-performance searches by splitting the indexing workload into two distinct components:
- Immutable Component ($T_S$): A read-only B+-Tree optimized for cache efficiency. Because it is static, it requires no locks for searching and uses a compact memory layout to maximize fan-out and minimize tree depth.
- Mutable Component ($T_I$): A set of smaller B+-Trees partitioned by value ranges. New tuples are inserted into these partitions. This value-range partitioning allows different CPU threads to perform concurrent insertions with minimal lock contention.
Delta Merging and Bulk Deletion
To manage the sliding window, the PIM-Tree utilizes a periodic merge process. When the mutable component reaches a threshold, its data is merged into the immutable component. Rather than deleting expired tuples individually—an expensive operation in standard trees—the system flags them and discards them in bulk during the merge phase, significantly reducing amortized maintenance costs.
Parallel Stream Join Algorithm
The authors developed an asynchronous parallel join algorithm to leverage the PIM-Tree's architecture. The algorithm utilizes a shared work queue for dynamic load balancing and a "nonblocking merge" strategy to prevent system stalls during index rebuilds. Furthermore, it tracks an "edge tuple" to maintain result correctness and prevent duplicates when processing tuples out of order across multiple threads.
Experimental Results
The PIM-Tree was evaluated against synthetic data streams with various distributions (Uniform, Gaussian, Gamma, and Shifting) to test resilience to data skew and dynamic patterns.
- Single-Threaded Performance: The PIM-Tree is 60% faster on average than a standard B+-Tree for stream band joins.
- Multicore Scalability: On an 8-core CPU (16 hardware threads), the parallel PIM-Tree join achieves up to a 5.5x throughput improvement over the single-threaded version.
- Comparison with Bw-Tree: The PIM-Tree approach is 2.6x faster on average than the Bw-Tree, a state-of-the-art latch-free index. While the Bw-Tree is optimized for read-heavy OLTP, it suffers from high conflict rates under the extreme update frequency required for sliding windows.
The primary trade-off is memory usage; the PIM-Tree requires approximately 2x the memory footprint of a standard B+-Tree due to its dual-component design and the buffers needed for nonblocking merges.
Conclusion
The PIM-Tree provides a high-performance solution for parallel index-based stream joins on multicore CPUs. By decoupling mutable and immutable components and employing bulk deletion, it overcomes the update bottlenecks of traditional indexes. Future work includes optimizing for Non-Uniform Memory Access (NUMA) architectures and extending the structure to support multidimensional data indexing.
Summary updated