Valkey kills the skiplist, cuts sorted set overhead by up to 43%
reconditerose
204 points
74 comments
November 17, 2026
Related Discussions
Found 5 related stories in 36.3ms across 3,874 title embeddings via pgvector HNSW
- A C++ Quicksort Faster Than std:sort signa11 · 38 pts · November 10, 2026 · 46% similar
- Optimizing Reference Deletions in Git nayak · 37 pts · November 08, 2026 · 45% similar
- Bbtree: Fastest Ordered Map aoli-al · 86 pts · October 24, 2026 · 44% similar
- Progressive disclosure in agents to make them 2.3x faster suchintan · 15 pts · October 24, 2026 · 38% similar
- Show HN: Maple – Sub-2-BPW Moe Pruning to Run Gemma 4 26B at 45 TPS on a 6GB GPU AmSach · 21 pts · November 08, 2026 · 38% similar
Discussion Highlights (15 comments)
reconditerose
Redis historically used a skiplist to keep a sorted index. Valkey showed its inefficient and slow on modern hardware, migrating to a B+ tree instead.
snissn
Do they provide their benchmark code?
WD-42
As a coding exercise I implemented a redis that utilized skiplists. I was excited to read this article. Turns out it's ai slop. Seriously people, stop it. This hurts to read.
tyre
Tangentially related, the PR sections for the final PR in this feature is quite nice[0]. There is a reviewing guide with suggested reading order, clear design decisions, and scope boundaries for what is intentionally not included. This is the type of thing LLMs are very good at and high ROI for human reviewers. [0]: https://github.com/valkey-io/valkey/pull/4206
dnchdnd
Is valkey the recommended redis alternative these days ?
hinkley
I have to say I was always on the fence about Bill Pugh (Mr Skiplist). Some of his concurrency ideas were pretty good but Skip Lists were about the same time I was realizing that theoretical and practical design for performance had diverged and skip lists were a huge cache miss liability. It didn't hurt that a few people I was aware had tried them had gone back to something else due to live performance analysis being negative or inconclusive (If you can't prove one thing is better than the other, you use the simpler one, and skiplists are not simple)
vivzkestrel
- valkey vs redis vs dragonfly 2027?
rsalus
I've long since moved to the MultiQueue algorithm for CPQs, seems like SkipList has vanishingly few use cases now...
dreamcompiler
> Every node carries a backward pointer Curious. Skiplists don't need back pointers. You can traverse a skiplist backward almost as fast as forward if you keep the "finger" around. The finger is the set of nodes from level-n down to level-0 that point as close to the goal node as possible without going beyond it. The ideal place to keep these nodes is on the stack. To traverse backwards, you do a conventional search for the starting node but every time you go down a pointer level, you push the last pointer on the stack first. Then back traversal becomes stack pops together with appropriate forward recursive calls when you pop back to a pointer that was too far to the left. It's easier to convey the idea with code than english but I'm not typing the algorithm with my thumbs into my phone.
jauntywundrkind
Thanks Bill Pugh for skiplists, worked great for so long. Go terps. https://dl.acm.org/doi/10.1145/78973.78977
antirez
For par condicio: I worked at a similar optimization for Redis using different techniques (when I submitted the PR my colleagues informed me that ValKey and another Redis team was working at it, I was not aware: the amoung the three implementation we picked mine after extensive benchmarks) reaching memory savings that sometimes can be tens of percentage of less RAM compared to this ValKey optimization. So if you are exited for less memory for sorted Sets you should try both the implementations. We also got a lot more speed in many use cases compared to the skiplist.
zaiyuan_dev
Curious how rank queries (ZRANK, ZRANGE by index) perform after the switch. Skiplists made those cheap via span counters; does the B+tree keep per-node subtree counts to match?
romange
Dragonfly lead with this idea in 2024: https://www.dragonflydb.io/blog/dragonfly-new-sorted-set
ummonk
Never could understand why sorted sets were implemented with skiplists instead of B+ trees in the first place.
peter_d_sherman
>"fbtree combines the high fanout and contiguous storage of a conventional B+ tree with several optimizations designed for Valkey's workload and memory allocator, including feature-based lookups, SIMD searches, linked leaves, and fast paths for sequential inserts and pops. In a 5-million-member test, it reduced per-member memory overhead by 36–43%, saving up to 109 MB." Nice! At some point I'd love to see a "shoot-out" benchmark between different B+ Tree based database back-end engines, in terms of Insert, Update, Delete, (and simultaneous occurrences of all of the above) etc., but not just for a single thread -- across multiple threads, CPU's/GPU's, different cache hierarchies, etc., and for absolutely gargantuan amounts of data... Which data structure and associated algorithms truly perform the best against a variety of truly heterogeneous (in this day and age, with all kinds of asymmetric hardware to choose from!) back-ends? Anyway, we welcome Valkey to the list of contenders!