-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rate and Burst configurations are not clear #92
Comments
It seems the "Leaky Bucket" algorithm is being used. The "Leaky Bucket" algorithm represents a model where incoming requests are added to a bucket from which they leak out at a constant rate, ensuring a steady and predictable flow of request processing. The bucket size determines the maximum number of requests that can be temporarily accumulated, allowing the system to handle short-term load spikes. This algorithm is used to prevent system overload and ensure even load distribution by discarding requests if the bucket is full. To answer your question: if you don't need to account for load spikes, you can do it like this: limit := redis_rate.Limit{
Rate: 2,
Burst: 1,
Period: time.Minute * 10,
} Thus, no accumulation of requests will occur, the first request will be allowed immediately, and the next one approximately 5 minutes later (10 minutes / 2). |
Hi, there. Thank you for providing such a simple and useful library.
There are some configuration options confuse me. What do 'Rate' and 'Burst' mean? How can I modify them to achieve the effect of 'maximum 2 times per 10 minutes'?
Hope to add some explanatory comments.
The text was updated successfully, but these errors were encountered: