3 ms·
Hi, that's a very interesting post, thanks a lot ! It's cool to see that sometimes a small lua script can do exactly what you need, instead of adding a new Redi
by rakoo 10y ago
Hi, that's a very interesting post, thanks a lot ! It's cool to see that sometimes a small lua script can do exactly what you need, instead of adding a new Redis command to the already very long list.
I have a question regarding "deployment" of Lua scripts (I've never used Redis for more than toys, so I may be wrong on something). I would assume a caller would do something like this just after the Redis cluster is up:
- calculate script's SHA
- EVALSHA a script
- script is not there
- EVAL script
And then later in the lifetime of the caller:
- calculate script's SHA
- EVALSHA script
Which means you wouldn't need to care about the script size, nor would you need to fiddle with your deployment pipeline.
Am I missing something ?
- kortox 10y agoHi, thats a good point and the approach you describe would work for a single Redis instance. In our case, we were using Twemproxy in front of Redis and it doesn't support Redis's "SCRIPT LOAD" command so we would need a way to load the script on each Redis node ahead of time. One other concern when using EVAL and EVALSHA through Twemproxy is guaranteeing that all keys in the command map to the same Redis node, in our case we only had one key so wasn't a concern. Documentation on that can be found here https://github.com/twitter/twemproxy/blob/master/notes/redis.md#scripting https://github.com/twitter/twemproxy/blob/master/notes/redis...