If using many thousands or even millions of rate limiters, it can be hugely beneficial to use a Cluster as the rate limiter storage in order to scale beyond one Redis instance. We can modify the rate limiter data model to take advantage of "Hash tags" in the cluster spec1 to ensure all keys for a limiter X resides on the same Redis instance within the cluster. This ensures that any related Lua script will have local data to work with when running within Redis.
Note that the Web UI functionality is not cluster-friendly; it uses SCAN to look for all limiters to list but but this will only scan one Redis instance. Nevertheless, for the largest users this limitation on visibility (who's using the Web UI to look at millions of limiters??) is a reasonable trade off to enable massive scale.
cc @sj26
If using many thousands or even millions of rate limiters, it can be hugely beneficial to use a Cluster as the rate limiter storage in order to scale beyond one Redis instance. We can modify the rate limiter data model to take advantage of "Hash tags" in the cluster spec1 to ensure all keys for a limiter X resides on the same Redis instance within the cluster. This ensures that any related Lua script will have local data to work with when running within Redis.
Note that the Web UI functionality is not cluster-friendly; it uses SCAN to look for all limiters to list but but this will only scan one Redis instance. Nevertheless, for the largest users this limitation on visibility (who's using the Web UI to look at millions of limiters??) is a reasonable trade off to enable massive scale.
cc @sj26
Footnotes
https://redis.io/docs/reference/cluster-spec/ ↩