resty-redis-cluster
resty-redis-cluster copied to clipboard
eval and some other suggestion
1.i note the Limitation say "Doesn't support transactions operations: MULTI DISCARD EXEC WATCH", so i use eval, but after a failed test and some studied of your SC, i found i can use "local key = {123456} return redis.call("set", "key1", "val1")" as the script for eval, in this way, your redis_slot can treat the script as a key with hashtag, and it worked, but it's a loosely solution, so i think if you can provide a special function for redis_lua to specify it's working slot(node).(case in my loosely solution, i can't use {} anymore, but {} is indispensable for lua.) 2.when i study youer 'handleCommandWithRetry', i found you use set_keepalive directly without checking redis operation's return value(so as you do in other function), case i think the return value may tell you some problem of cosocket which is not recommend to recycle the connection to connections pool. 3.i think use resty.core.regex instead of lua string regex operation can receive much performance boost:) 4.and some spell error, like: DEFUALT_MAX_REDIRECTION
Sorry for late response, thanks for your suggestion:)
for #2 and #4, adding error return in case there is error while set keep alive, also fix spelling.
for #3, I did some test at parsing and capture the string in hashtag, however, it didn't show any improvement and even slow. (Instead the code to parse ASK signal by ngx.re did improve performance )
for #1 Yes, we may add this feature, but still transaction is not recommended in rediscluster spec , only using hashtag is more reasonable.
at 2, i mean if excute redis command may cause connection err and still return the bad connection to connection pool will lead connect action may get this bad connection later. for 3, you have ngx.re or ngx.core.regex to test? for ngx.core.regex is high performance.
for 2, change the code for 3, enable ngx.re with jo option and require resty.core.regex. However parse hashtag is not fast than now.
OK, i'll do some test for3 with resty.core.regex later when i was free:)
it's me again, i though you should pass a count to init_pipeline of resty.redis,this will bring you a little performance improvements.