Friday, 14 April 2017

NodeRedis client.multi() hgetall performance

node version: v7.4.0

node-redis version: v.2.6.2

redis_version:2.8.4

ubuntu 14.04 2GB RAM VPS instance

I'm getting indications that node_redis hgetall performance isn't what it should be, but possibly I'm doing something wrong. I have a sorted set with 31669 elements. The elements are hash keys and each hash is ~2K bytes. Retrieving the hashes takes ~64 seconds which seems too slow. Here is what the function looks like:

function getAllAnnotations()
{
var currentSeconds = Math.floor((new Date()).getTime() / 1000);
console.log('currentSeconds before zrange: ' + currentSeconds);

    client.zrangebyscore("geoHashSortedSet", "-inf", "+inf", function(err, reply) {

        multi = client.multi();
        for (var uuid in reply) {
            multi.hgetall(reply[uuid]);

        }
        multi.exec(function(err, replies) {

            var currentSeconds = Math.floor((new Date()).getTime() / 1000);
            console.log('currentSeconds after multi returns: ' + currentSeconds);
            allAnnotations = replies;
        });

    });

}

Do others here agree that this is poor performance, and is there anything I'm doing in the code above that is part of the issue?



via bhartsb

No comments:

Post a Comment