Distributed rate limiter with HRW in Elixir 0 ▲ jola.dev 1 hour ago · Tech · hide · 0 comments This is a continuation of Elixir Cluster 101. So let's talk about putting what we learned into practice using the case of ratelimiting. Many implementations default to running in memory, meaning that they don't synchronize across multiple nodes. In most programming languages you would immediately reach for something like Redis to tackle this. It’s a great tool for sharing state across nodes, especially where your expectations on consistency and fault tolerance are lower, like the case of rate limits. But we have the option of avoiding adding another service to our stack: we can take a rate limiter that runs in local memory and make it (mostly) consistent across a cluster of nodes. We do this by using an algorithm for assigning each key, whether IP, user ID, or organization ID, to a specific node, and then ensure that all rate limit lookups are routed to the correct node. Traditionally this has been done using ExHashRing (the battle-tested consistent hashing implementation for Elixir),… No comments yet. Log in to reply on the Fediverse. Comments will appear here.