Valkey Changes How It Stores Big Leaderboards and Gives Backups Another Option
Valkey 9.2 uses a more compact index for large sorted sets and can save a snapshot on a background thread. One change reduces overhead per entry in a particular test. The other can smooth memory spikes during backups. They do not save the same bytes.
On November 19, the in-memory database project Valkey announced its stable 9.2 release and listed downloads. Large sorted sets switch to a B+ tree index, and snapshots can run without starting a child process. Arch Linux packaged 9.2.0-1 in its Extra repository that day. That is a sign of downstream availability, not evidence that production servers are seeing the same gains.
After Redis changed its license in 2024, the Linux Foundation announced Valkey as a project continuing from Redis 7.2.4. One familiar feature is the sorted set: it can display players by score and still let a program ask for one person’s rank. The user sees a leaderboard; the server keeps an index to find people and scores and change the order. Valkey’s engineering notes explain that larger sets used a skip list, which jumps forward through levels of pointers. The replacement packs records into tree nodes and needs fewer pointers per entry. The commands stay the same, so applications do not need to rewrite their leaderboards to use the new index. What changes is how the database lays out and finds the records.
Another memory cost comes from backups. The old approach starts a child process to write the snapshot. It initially shares memory with the main process; active writes can make it necessary to keep old contents of changed pages, increasing temporary memory use. The optional approach uses a background thread instead. It is off by default. The project’s documentation says enabling its infrastructure adds four bytes per key, some writes may briefly wait during a save, and certain cases still fall back to the old approach. The cost shifts rather than disappearing.
That is why one percentage cannot size a server. With five million 20-byte members, the project reported 36–43% lower overhead per member for large sorted sets, not that much less memory for the entire instance. Services add and remove entries at different rates, so that result cannot be assumed for every leaderboard. A leaderboard-heavy service and a cache full of short key-value entries will not get the same bill. Backups also need a separate check on whether the slowest requests start taking longer.
iHolyshit review
Over the next six to twelve months, I’d look for two same-machine comparisons from teams outside the project: memory use as a leaderboard is repeatedly updated and pruned, and peak memory and 99th-percentile latency during a backup under heavy writes. I’d want the key sizes and write rates alongside those results. Seeing how much memory was saved and how much longer requests waited in the same experiment would reveal where each change earns its keep.
Share this article
What do you think of this story?
Anonymous feedback, up to 5 reactions per article.
Reader comments
Comment without signing in, or sign in to display your member name.
Discuss the technology and the story. Hate, politics and war, threats, abuse, personal accusations, sexual content, ads, links and personal information are not allowed.
No comments yet. Be the first to share.