0

I want to use Redis with java Redisson library. I have a task to store items in a sorted order, based on some item's field. There are three main constraints:

  1. Sorting field of items could be updated quite often. There could be up to 25k updates per second for the whole collection.
  2. I need to get an actual rank of each item in my collection very fast (up to 5 ms).
  3. The collection size could be up to 25 millions items.

Is it ok to use Redissons ScoredSortedSet.rank method with such constraints, or it is not suitable and there is a better solution?

Kivan
  • 1,712
  • 1
  • 14
  • 30

2 Answers2

1

Yes everything is possible with ScoredSortedSet (it is mapped to Redis Sorted Set), but I need to convert my field to score so that ScoredSortedSet works. Nikita suggests to use RSortedSet or PriorityQueue, however they do not have 'rank' command, which I needed.

Kivan
  • 1,712
  • 1
  • 14
  • 30
0

I have a task to store items in a sorted order, based on some item's field

You should use RSortedSet or PriorityQueue instead of ScoredSortedSet. Because ScoredSortedSet uses numbers to maintain order and RSortedSet or PriorityQueue use Comparator which used to compare by object fields.

Nikita Koksharov
  • 10,283
  • 1
  • 62
  • 71
  • Ok, thx Nikita! What about my load constraints, are they realistic with Redis and Redisson? – Kivan Apr 06 '17 at 19:23