A smarter rate limiter that has a leaky-bucket type implementation

Does anyone know of a rate limiting lib that limits based on a leaky-bucket algo?

I read how you can use ETS to keep track of usage and refresh the limiter every x minutes, but I want something that will help in terms of smoothening out the usage.

If you only use a counter that refreshes every minute, you can get bursts of usage and then get halted for the remainder of the threshold. A leaky bucket algo will smoothen out the usage over the duration.

There is a go lib that I used that is pretty cool, it basically blocks for a short period of time until it gives you a “token” to go ahead.

My app connects to a few 3rd party libraries, and I need a rate limiter for each one.

1 Like

According to a simple search on Hex.PM I believe there are many. :wink:

4 Likes