Technology
Hacker News

Valkey kills the skiplist, cuts sorted set overhead by up to 43%

Source Entity

Hacker News

November 21, 2026
Valkey kills the skiplist, cuts sorted set overhead by up to 43%

Valkey 9.2 has replaced the traditional skiplist structure with a B+ tree variant called fbtree. This architectural shift significantly improves memory efficiency, reducing overhead in large sorted sets by up to 43%.

The Architectural Evolution of Valkey

The release of Valkey 9.2 marks a significant milestone in memory-efficient data structures by replacing the long-standing skiplist implementation with a high-fanout B+ tree variant known as fbtree. For years, skiplists have been the backbone of sorted sets in key-value store architectures, providing probabilistic balancing and logarithmic time complexity. However, as datasets grow, the memory overhead associated with maintaining these pointer-heavy structures has become a bottleneck, often consuming more space for metadata than for the actual data elements themselves.

Understanding the fbtree Innovation

The transition to fbtree represents a shift toward more cache-friendly and compact data layouts. Unlike a skiplist, which relies on a multi-level linked structure, the fbtree leverages the contiguous storage properties of a B+ tree. This approach is specifically engineered for high-fanout scenarios, which minimizes the depth of the tree and improves traversal efficiency. By consolidating data, the fbtree naturally reduces the fragmentation that often plagues pointer-intensive structures in memory-constrained environments.

Strategic Optimizations for Performance

Valkey's implementation of fbtree is not a standard B+ tree; it includes several performance-oriented optimizations. These include the use of SIMD (Single Instruction, Multiple Data) instructions to accelerate search operations, feature-based lookups, and linked leaves that facilitate efficient range scanning. Furthermore, the architecture includes fast paths for sequential inserts and pops, which are common access patterns in high-throughput database workloads, ensuring that the memory gains do not come at the cost of latency.

Impact on Memory Efficiency

The practical benefits of this transition are substantial. In rigorous testing involving 5-million-member sorted sets, the implementation achieved a 36–43% reduction in per-member memory overhead. In absolute terms, this equates to savings of approximately 109 MB per dataset. For infrastructure engineers managing massive, memory-bound caches, this optimization effectively increases the capacity of existing hardware, allowing for larger datasets to reside in RAM without necessitating costly server upgrades.

Broader Implications and Future Trends

This move signifies a broader trend in database engineering where the focus is shifting from simple algorithmic complexity to hardware-aware data structures. As CPU cache hierarchies become more complex, data structures that prioritize locality and contiguous memory access—like the fbtree—are becoming the gold standard. By moving away from the listpack threshold limitations of traditional skiplists, Valkey is positioning itself to handle high-scale, memory-intensive applications more effectively than its predecessors.

Conclusion

The replacement of the skiplist with fbtree in Valkey 9.2 is a critical advancement that addresses the fundamental trade-off between search performance and memory consumption. By optimizing for modern CPU architectures and memory allocation patterns, Valkey has set a new benchmark for efficiency in key-value stores. As systems continue to scale, these granular improvements in data structure design will remain essential for maintaining performance in increasingly resource-intensive production environments.

Verification Required?

Read the full report from the primary source

Go to Hacker News