go-redis / redis_rate

Rate limiting for go-redis
https://redis.uptrace.dev/guide/go-redis-rate-limiting.html
BSD 2-Clause "Simplified" License
844 stars 101 forks source link

Latency benchmarks #73

Open abinavv20 opened 2 years ago

abinavv20 commented 2 years ago

I was wondering if there is any data on latency benchmarks on the redis_rate client that is publicly available

From the code, any Allow() call in rate limiter runs evalsha, where Redis pushes arguments to a Lua stack, run the Lua script, and then pop the value off which has significant latency implications on redis. Also, running the script blocks other clients as well.

I have verified this by running the SLOWLOG command where the evalsha cmd in Allow() takes up to 15ms.