It is interesting that you can ask for single elements of an hash, like in: GET object:*->field
With 2.6 and scripting this kind of optimizations will become the rule.
Excited for 2.6 and scripting. Has much changed on the scripting side since the 2.2-scripting branch?
There is a trick, (used by some memcached client as far as I know), to do that without multiplexing, that is, usually you should do something like this:
send GET foo to socket1
send GET bar to socket2
replies = some_form_of_multiplexing(socket1,socket2)
Instead since we can observe that usually the round trip time between the peers at socket1 and socket2 are similar, we can do: send GET foo socket1
send GET bar socket2
reply1 = read(socket1)
reply2 = read(socket2)
This makes the implementation simpler without making the performances so much worse.So a good Redis client for a sharded environment should be able to do something like this:
replies = parallel_queries(["GET","foo"],["GET","bar"],["INCR zap"])
Trying to send the queries to all the servers in parallel and returning the replies ASAP, and in the right order of course.Learned so much today!