<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh" -->

---
title: Distributed rate limiter with HRW in Elixir | daily.dev
description: A practical guide to building a cluster-aware rate limiter in Elixir without Redis, using HRW (Highest Random Weight / Rendezvous Hashing) to route rate limit...
canonical: https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Distributed rate limiter with HRW in Elixir | daily.dev
og:description: A practical guide to building a cluster-aware rate limiter in Elixir without Redis, using HRW (Highest Random Weight / Rendezvous Hashing) to route rate limit...
og:url: https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh
og:image: https://api.daily.dev/og/posts/Hq5ZuC3vH.png
og:image:alt: Distributed rate limiter with HRW in Elixir
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Distributed rate limiter with HRW in Elixir

**[Awesome Elixir](https://daily.dev/sources/awelix)** · 5 min read · 1 upvotes · 0 comments

## Summary

A practical guide to building a cluster-aware rate limiter in Elixir without Redis, using HRW (Highest Random Weight / Rendezvous Hashing) to route rate limit checks to the correct node. The approach uses the Hammer library with an ETS backend and a GenServer that delegates requests to the node responsible for a given key. HRW is presented as a simpler, stateless alternative to ExHashRing for small clusters (under 10 nodes), with minimal key reassignment when nodes join or leave. The pattern generalizes to distributed caching and ephemeral event tracking as well.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://jola.dev/posts/distributed-ratelimiter-with-hrw>

## Questions this post answers

### How can I make a local in-memory rate limiter consistent across an Elixir cluster without adding Redis?

Use an algorithm like HRW (highest random weight, rendezvous hashing) or consistent hashing to assign each rate-limit key, such as an IP or user ID, to a specific cluster node, then route all lookups for that key to the owning node via GenServer.call with the node name. This keeps rate limiting stateful but local, avoiding the need for a shared service like Redis while still auto-scaling safely since both algorithms cause minimal key reassignment when nodes join or leave.

_daily.dev surfaces practical patterns like this for engineers weighing Redis against in-cluster solutions._

### What is the difference between HRW and ExHashRing for distributing keys across nodes in Elixir?

HRW (highest random weight, rendezvous hashing) is a stateless alternative to ExHashRing's consistent hashing implementation, and for clusters with fewer than 10 nodes it can be faster with slightly better key distribution. Unlike ExHashRing, HRW requires no stateful ring structure to maintain, simplifying the implementation while both approaches minimize key reassignment as the node list changes.

_developers picking a hashing strategy for clustered elixir nodes can track trade-offs like these on daily.dev._

## Similar posts on daily.dev

- [28 Million Decisions Per Second. Zero Allocations. One Rate Limiter.](https://daily.dev/posts/28-million-decisions-per-second-zero-allocations-one-rate-limiter--a6kmxkmhy) · Medium · 0 upvotes · 0 comments
- [Python Rate Limiting: The Limiter That Caused Our Outage](https://daily.dev/posts/python-rate-limiting-the-limiter-that-caused-our-outage-2y3xnfeyu) · SitePoint · 0 upvotes · 0 comments
- [High Performance Rate Limiting at Databricks](https://daily.dev/posts/high-performance-rate-limiting-at-databricks-lln88cxlb) · ByteByteGo · 13 upvotes · 0 comments
- [Sliding-Window Rate Limiters with TypeScript & Redis](https://daily.dev/posts/sliding-window-rate-limiters-with-typescript-redis-johtnq4x1) · SitePoint · 0 upvotes · 0 comments

---

Tags: [#elixir](https://daily.dev/tags/elixir), [#distributed-systems](https://daily.dev/tags/distributed-systems)

[View this post on daily.dev](https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Distributed rate limiter with HRW in Elixir","url":"https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh"},"datePublished":"2026-08-05T07:20:17.870Z","dateModified":"2026-09-14T08:35:08.870Z","description":"A practical guide to building a cluster-aware rate limiter in Elixir without Redis, using HRW (Highest Random Weight / Rendezvous Hashing) to route rate limit...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0d1a286c1a1a4adc6d9ff2ccbc1ce05e?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0d1a286c1a1a4adc6d9ff2ccbc1ce05e?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Awesome Elixir","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Awesome Elixir","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/85a474f78b1b4d349119f7ce60d1438e","url":"https://daily.dev/sources/awelix"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"elixir,distributed-systems","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Awesome Elixir","item":"https://daily.dev/sources/awelix"},{"@type":"ListItem","position":3,"name":"Distributed rate limiter with HRW in Elixir"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/distributed-rate-limiter-with-hrw-in-elixir-hq5zuc3vh#faq","mainEntity":[{"@type":"Question","name":"How can I make a local in-memory rate limiter consistent across an Elixir cluster without adding Redis?","acceptedAnswer":{"@type":"Answer","text":"Use an algorithm like HRW (highest random weight, rendezvous hashing) or consistent hashing to assign each rate-limit key, such as an IP or user ID, to a specific cluster node, then route all lookups for that key to the owning node via GenServer.call with the node name. This keeps rate limiting stateful but local, avoiding the need for a shared service like Redis while still auto-scaling safely since both algorithms cause minimal key reassignment when nodes join or leave. daily.dev surfaces practical patterns like this for engineers weighing Redis against in-cluster solutions."}},{"@type":"Question","name":"What is the difference between HRW and ExHashRing for distributing keys across nodes in Elixir?","acceptedAnswer":{"@type":"Answer","text":"HRW (highest random weight, rendezvous hashing) is a stateless alternative to ExHashRing's consistent hashing implementation, and for clusters with fewer than 10 nodes it can be faster with slightly better key distribution. Unlike ExHashRing, HRW requires no stateful ring structure to maintain, simplifying the implementation while both approaches minimize key reassignment as the node list changes. developers picking a hashing strategy for clustered elixir nodes can track trade-offs like these on daily.dev."}}]}
```

