Overview of Concurrent Trees
masterConcurrent Trees is a Java library providing high-performance, concurrent implementations of Radix Trees and Suffix Trees. It is designed for high-concurrency scenarios where read operations are frequent and must be lock-free, while writes are handled as background or low-concurrency tasks.
Core Data Structures
- Radix Tree: A space-optimized prefix tree. Useful for hierarchical keys (file paths, nested categories), "starts with" lookups, and auto-complete features.
- Suffix Tree: An extension of the Radix Tree that allows looking up any suffix or fragment of a key. Useful for "contains" lookups and finding common substrings across documents.
Concurrency Model
- Lock-free Reads: Reading threads never block, even during active writes, ensuring consistent latency.
- Atomic Updates: Changes are assembled into a patch and applied in a single atomic operation, treating the tree as a mostly-immutable structure. This ensures readers see either the old version or the new version, but never an inconsistent state.
- Write Behavior: Writing threads block each other but do not block reading threads.