Hammer: a rate-limiter with pluggable backends

Hi all :slight_smile:

I made a rate-limiter with a pluggable backend system, so you can choose where the rate-limiting counters are persisted to. I felt the need to do this because the most popular rate-limiter (ExRated) only persists to ETS, which isn’t so useful in bigger deployments with load-balancing, etc.

The main package is https://github.com/ExHammer/hammer, which includes an ETS backend. There is also a Redis backend: https://github.com/ExHammer/hammer-backend-redis.

I’ve also put together a demo Phoenix app.

The best place to jump in is probably the Tutorial

Any and all feedback would be greatly appreciated!

13 Likes

We’ve released Hammer version 2.0.0, with a drastically improved API, making it easier to add Hammer to your projects:

We are also working on new storage backends, including a backend for Ecto.

7 Likes

I am experiencing a wierd issue with hammer_backend_redis seeing

"[reason: :closed, __struct__: Redix.ConnectionError, __exception__: true]"

I am using the same redis I use for Phoenix.PubSub and no issue with it. Any idea if its because redis is shared or possible cause to this ?