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 limiting outgoing requests #256
Comments
@janekolszak Thank you for your appreciation and suggesting a new feature in Resty as client-side rate-limiting. It will be a good addition. Typically server-side rate-limiting is known for, it would be good to try out on client-side too. If you have a design suggestion or recommendation. Please post here on the thread. Currently, I'm bit occupied in at my day work. I will get to it once I get time. Thanks! |
One options is to use github.com/didip/tollbooth since it 's already battle tested and simple. Create the limiter with something like this
When making the request just use
For a global, per-client limiter would be a const string. But one could also use per remote endpoint limiting. This would be an overkill if we only need a global per-client limiter. It'd introduce a separate goroutine for caching limited keys. |
I think that the best option is to use https://godoc.org/golang.org/x/time/rate and just create one limiter per resty client. When making the request we'd just run Let me know if you want me to write it. |
I am also interested in having rate limiting. However, to avoid locking into one particular interface, I suggest adding the ability to wrap executors and let users add limiters how they see fit: #477 |
@lavoiesl Thanks for showing your interest, I agreed about not locking into one particular interface. |
Hi, I needed client side rate-limiting for a personal project so I did a short implementation based on I created a pull request: #494 If you think this would be useful for Resty don't hesitate to ask for changes. |
Hello there I implemented my own rate limiter with httpTransport and friends, but I wonder if the rate limiting affects the timeout of the request, because I am getting a lot of those errors on my project, where I do thousands of requests per sec. |
hey @jeevatkm, i'm also interested in client side rate limiting! any chance you'd be open to a PR for it? or could you take a look at the PR above? |
@dbriemann @SVilgelm have contributed this feature. It has been released in v2.9.0 |
Is the intention to make callers wait for the rate limit? It would be more useful if resty did the waiting instead of immediately throwing an error. Having to add waiting on the rate limiter in my caller means I don't need to set a rate limiter in resty. |
Hi!
Thank you so much for this project, it saved me a lot of time!
Do you plan on adding a per-endpoint rate limiter, or a global rate-limiter of outgoing requests?
Thanks
The text was updated successfully, but these errors were encountered: