When tested Kong's rate-limiting plugin with redis config, found Kong is not setting TTLs for all the keys, some of the keys are having -1 ttl which is increasing the data in redis and slowing the repsonse from redis server.
Why the issue is happening:
During the increment we are checking whether the key exists in the redis or not and only setting the ttl if the key is not present in the redis.
https://github.com/Kong/kong/blob/master/kong/plugins/rate-limiting/policies/init.lua#L177

ab -n 10000 -c 20 http://127.0.0.1:8000/testapiYes, we should make that a redis function.
We can create a pr to fix this issue along with redis sentinel support in rate-limiting. Our team has ran performance tests with different configurations on rate-limiting plugin, we can also share those results along with PR.
@vasuharish, sound like a plan! I am glad to review such PR! Bring it on ;-)!
Hi @bungle , created PR for the fix, can you please take a look at the PR. thank you
Most helpful comment
We can create a pr to fix this issue along with redis sentinel support in rate-limiting. Our team has ran performance tests with different configurations on rate-limiting plugin, we can also share those results along with PR.