Comments (8)
Hi,
Would you elaborate on the use case for this? Do you have a project already, or is it a theoretical interest?
from ratelimit.
@rabbbit I am working on it and evaluating various rate limiters. This is inspired by https://github.com/Netflix/concurrency-limits and wanted to reuse any existing libraries if present.
from ratelimit.
Goal: To use this library with an adaptive rate limiter algorithm like Vegas or AIMD
Problem: Right now the library exposes no way to update the rates dynamically.
There are two ways to solve for this
- Create a new rate limiter every time I want to update limits
- Dynamically update the rate limit on the object
Would like feedback on which is the preferred approach. Or if there is any other way.
I read the go files in this repo, first way is the better way for this ratelimit, I think, because limit is not direct influence to this ratelimit
from ratelimit.
@rabbbit If we update the perRequest value in limiter_atomic.go:41
we should be able to dynamically change the rate. Can I go ahead and contribute? Or do you prefer that we stick to create a new ratelimit object when we want to change the rate?
from ratelimit.
It's not just perRequest. Since we also store slack, we'd need to update (or throw away?) the actual slack value. We'd also need to do it atomically, so there's extra complexity there.
Is creating a new limiter feasible? If so, that would be my preference.
from ratelimit.
@rabbbit sure, I don't see any concerns with it, at worst case scenario we'd be creating a new object every couple of seconds till we hit a stable point. You see any concerns with that?
from ratelimit.
@rabbbit BTW I'm implementing Vegas congestion control on top of this library.
from ratelimit.
from ratelimit.
Related Issues (20)
- X-Rate-Limit
- this line of doc is wrong
- When one of my operations has not called the atomicInt64Limiter.task() function for a long time, the speed limit may fail to be called again HOT 1
- change limit after start HOT 1
- Release all recent changes with a new v0.3.0 tag. HOT 1
- Unexpected results on CI with higher loop iterations
- This is rate shaping, not limiting HOT 1
- Take always return without block if it enters the case branch HOT 3
- [Docs] Need to illustrate the option `Slack` HOT 6
- The "slack" option doesn't make effect when use newAtomicInt64Based version rate limit
- Behavior of take in goroutine HOT 1
- benbjohnson/clock is out of date HOT 1
- context.Context support for Take? HOT 7
- If add some check in New function?
- Support for increasing/decreasing limits on the fly HOT 5
- What's the major diff v.s. https://pkg.go.dev/golang.org/x/time/rate HOT 1
- Adding support for an `Allow` method HOT 10
- Why does the example_test fail when I run it locally? HOT 2
- atomicInt64Limiter WithoutSlack doesn't block HOT 18
- Can you support the take method of non blocking sleep
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ratelimit.