节点版本:V7.4.0NodeRedis client.multi()hgetall性能
节点redis的版本:v.2.6.2
redis_version:2.8.4
的ubuntu 14.04 2GB RAM VPS实例
我得到的迹象表明,node_redis hgetall性能不是它应该是,但可能我做错了什么。我有一个有31669个元素的排序集。元素是散列键,每个散列有14个字段,大小约为256字节。检索散列需要64秒,这似乎太慢了。 下面是函数的样子:
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;
});
});
}
千万人在这里都认为这是表现不佳,有什么我做在上面的代码,这是问题的一部分?
您是否尝试过['client.batch()'](https://github.com/NodeRedis/node_redis#clientbatchcommands)?你也不只是计时批次,而是'zrangebyscore'。 – robertklep
我会尝试client.batch()。是的,我意识到我正在计时zrangebyscore。大概我不应该包括它。谢谢。 – bhartsb