Search code examples
luaredisreplication

Redis replication without lua


Some information that's important to the question before describe the problems and issues.

Redis lua scripting replicates the script itself instead of replicating the single commands, both to slaves and to the AOF file. This is needed as often scripts are one or two order of magnitudes faster than executing commands in a normal way, so for a slave to be able to cope with the master replication link speed and number of commands per second this is the only solution available.

More information about this decision in Lua scripting: determinism, replication, AOF (github issue)).


Question

Is here is any way or workaround to replicates single commands instead of executing LUA script itself?

Why?

We use Redis as Natural language processing (Multinomial Naive Bayes) application server. Each time you want to learn on new text you should update big list of word weights. The word list with approximately 1,000,000 words in it. Processing time using LUA ~350 ms per run. Processing using separate applicaton server (hiredis based) is 37 seconds per run.

I think about workaround like this:

  • After computation are done transfer key to other (read only server) with MIGRATE
  • From time to time save and move RDB to other server and load it my hands.

Is here is any other workaround to solve this?


Solution

  • Yes, in the near future we're gonna have just that: https://www.reddit.com/r/redis/comments/3qtvoz/new_feature_single_commands_replication_for_lua/