Lua execution in Redis - Atomicity & Scale? -


i have keys in redis <k,v> v comma separated string of sub strings v: <v1,v2,v3,...,vn>.

until setting keys using transaction in jedis (redis api in java). new requirement needs me perform operations on existing keys. have 2 options:

  1. retrieve keys, perform operations, set keys
  2. code operations in lua , pass file along keys arguments.

option 2 seems faster save round trip have following considerations:

  1. what if lua execution fails in between @ redis, after n keys. (may issue script or redis). redis ensure consistency? in option 1, abort writing , prevent inconsistent state.
  2. lua script understand takes keys arguments. need operate on 10 million keys. lua fine such huge argument list?

my solution

since said answer below none of them feasible choice. wrote own redis command in c , compiled source. call

redis-cli> mycommand k v 

for each <k,v> in pipeline. followed tutorial here - hacking redis. might not adequate , require 1 browse , understand code yourself!

wrt #1 - lua script atomic not provide type of consistency assurance. in case script fails, updates not rolled redis automatically. there proposal improve behavior yet accepted redis (see josiah carlson's blog here: http://www.dr-josiah.com/2015/07/transactions-in-redis.html)

wrt #2 - don't know if such huge list go smoothly or not if need you're using wrong ;)


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -