I'm considering replacing Redis with Aerospike and I wanted to know if aerospike is capable of delivering the same capabilities and performance as Redis's sorted sets for Leaderboards within an application. I need to be able to quickly insert, read and update items in the set. I also need to be able to do range queries on them and retrieve the rank of an arbitary item in the set quickly.
1 Answers
Aerospike does not currently have a built-in Leaderboard feature. However, this is one of many functions that anyone can build with User Defined Functions (UDFs) and Large Data Types (LDTs).
The way this would work is you would have a set of UDFs that employs two Large Ordered List LDTs. One LLIST would manage the primary collection, and the other LLIST would provide the Leaderboard/Scoreboard ordering (basically used as an index into the primary collection).
The UDFs would manage the user interaction (read/write/delete primary value and read/scan leaderboard value) and pass the work on to the LDT functions.
We've talked internally about building these examples to show the power of UDFs and LDTs. Perhaps, with a little incentive, we could raise the priority of getting these examples done.
The other issue is performance. What are your latency and throughput requirements?

- 69
- 1
-
2I would ideally like to keep latency below 20ms for reading a list of say 10 items along with their ranks from a set of approximately a million items. I'm not sure what sort of throughput I'm expecting, I'll probably scale up as required to ensure the latency stays low. I would love to see an example implementation of a UDF that can do this using LDTs as you described. – Johny Jose Nov 13 '14 at 09:02
-
1I would also love seeing this example. It's a common example which would make Aerospike more appealing to the masses :) – Jordan Dec 16 '14 at 20:06
-
We need an example. Is my understanding correct, that such queries that use an secondary index would be kinda as fast as a normal multi get on an equal amount of returned items? 1. Traversing an in-memory index, 2. gathering the item data (payload) from ssd, returning all. – Manuel Arwed Schmidt May 16 '15 at 12:06
-
1Turns out there is one java example for leaderboards (only usefull if you try to find the extreme n points e.g. biggest or smallest, not usefull if you want paginated stats). https://github.com/helipilot50/aerospike-top-10-aggregation – Manuel Arwed Schmidt May 16 '15 at 14:42