-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Description
Describe the bug
Hi all,
I was wondering if anyone might be able to shed some light on this rather unusual behaviour I've been experiencing.
I have a sorted set with 1m entries, and using ZREVRANGE to get the player's ranking, plus the two players above and below. I'm using node-redis on Ubuntu 20.04.3. However, now that I've upgraded from Redis 5.0.7 to 6.2.6, the very same code is taking 50% longer to complete. I'm using the node-redis multi() command, as (for reasons I'm not entirely clear about) it has better performance than batch(), Whether I bunch my requests up into 100k batches, or 10k batches, the result is the same.
On Redis 5.0.7 (the version on apt-get), I can pull the results for every player in 966ms. On 6.2.6 that same set of queries takes 1.415s to complete.
Other queries are unaffected - I also get ZREVRANK for every player, and that took 1.8s before, and 1.8s now.
To reproduce
It should be possible to reproduce with a 1 million entry sorted set. The sorted set is literally just a list of incremental IDs, and a randomly allocated score between 0 and 500.
Here's the code I'm using for the retrieval
function getdata(n){
var loopinc = 100000;
var final = 1000000;
if(n == 1){
var target = loopinc;
var initial = 1;
}else{
var initial = (n - 1) * loopinc;
var target = n * loopinc;
}
console.log('start from: '+initial+', stop at: '+target);
for(i = initial; i < target; i++){
if(i < 2){
multi.zrevrange('lb', 0, 5);
}else{
multi.zrevrange('lb',(i -2), (i + 2));
}
}
var start = performance.now();
multi.exec(function(err, reply){
var end = performance.now();
var redisstart = (parseInt(reply[0][0]) * 1000) + (parseInt(reply[0][1]) / 1000);
var redisend = (parseInt(reply[(reply.length - 1)][0]) * 1000) + (parseInt(reply[(reply.length - 1)][1]) / 1000);
var execution_time = redisend - redisstart; // in milliseconds
console.log('Execution time: '+execution_time);
totalarr.push(execution_time);
console.log('Retrieved in '+(end - start)+' ms');
if(target < final){
n++
getdata(n);
}else{
var total = totalarr.reduce(function(previousvalue, currentvalue) { return previousvalue + currentvalue; }, 0);
console.log('total execution time: '+total);
}
});
}
getdata(1)
Steps to reproduce the behavior and/or a minimal code sample.
Expected behavior
The same performance as on 5.0.7 rather than being 50% slower.
Additional information
Platform: Ubuntu 20.04.3 LTS
Redis: 5.0.7 or 6.2.6
Interfacing with node-redis 3.1.2
Metadata
Metadata
Assignees
Labels
Type
Projects
Status