Fast single node rate limiter implementing Token Bucket algorithm. The goal is to provide dependable solution that JustWorks™ with a focus on performance, correctness and ease of use. Bucket data is stored using :atomics module. Bucket references are stored in ETS and optionally cached as persistent terms.
Features
lock-free and race-free with compare-and-swap operations
BlazingFast™ performance, see benchmarks section in the readme. Req/s go brrrrrr
monotonic timer for correct calculations
millisecond tick supporting wider range of parameters and preventing request starvation
automatic calculation of bucket parameters based on average rate and burst size
handy timeouts for retries
compile-time validation of arguments when possible
Haha, thank you! I must now write a little blog post about atomics and will have to name you in it! That’s what you’re getting for sharing your good work online! Take that