3

I need get about 10k hashes from redis server. Since there is no command to get multiple hashes in redis I was iterating through the all keys using db.HashGetAllAsync() call and then waiting all tasks to complete. Even though it worked I saw a dramatic latency spike on RedisLabs dashboard during these calls.

Is there any ways to get many hashes at the same time? Maybe there is any ConnectionMultiplexer settings that may help in this situation?

pauliusnrk
  • 593
  • 7
  • 18
  • Are you running multiple invocations of this call, then awaiting all of the results to be returned? If so, how many concurrent connections are you running? – The Real Bill Mar 18 '15 at 00:32

1 Answers1

2

There is no varadic hgetall, so yes: the simplest approach would be to pipeline a huge number of individual hgetall. The only other thing you could even possibly do would be to use a Lua script (eval/evalsha) to generate multiple items in each item, but I can't see how this would reduce server load or bandwidth any, so it doesn't seem to be worth trying!

Either way, yes: this will generate some work on the server.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I guess using Lua script in situation where I'm trying to get 10k hashes would put other redis calls to queue and increase latency even more. – pauliusnrk Mar 17 '15 at 13:22
  • 2
    @pauliusnrk yep, I'd guess so too; your *best bet* here, IMO, would be to do the bulk hash read from a slave – Marc Gravell Mar 17 '15 at 13:46