-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add fair dispatcher #111
base: main
Are you sure you want to change the base?
Add fair dispatcher #111
Conversation
We need to handle situations where a single dispatch currently sends multiple batches to the same consumer because the round robin does more than one loop. |
Yup! And GenStage master passes the length to dispatch, so you can calculate how many batches goes to a given process. |
|
I know this is a quite old PR - but curious if there has been any more thought around this additional type of dispatcher? I have a scenario that could greatly benefit from something like this where I use GenStage to distribute work to a large number of distributed commodity (spot instance) nodes/servers. It works fine, but depending on things like spot instance prices, I'd like the ability to bring on instances of various sizes/computing power and have them subscribe with demand numbers that reflect their inherent resources (cpu count, etc). I'm absolutely open to any criticisms around this idea, so if i'm thinking about this idea wrong, let me know. Obviously I can roll my own dispatcher, but just wanted to dig this up from the grave before I go down that road :) |
@amokan I believe you would need a |
@fishcakez Thanks for the feedback and that does make sense. I'm going to look closer at your implementation on Monday and work through some test cases and see what I can come up with in regards to the idea around weight. |
@josevalim can we close this PR? |
I would keep it open in case someone wants to give it a try or so. |
Attempt to provide more even distribution to consumers than demand dispatcher. It should allow different max demands but prevent greedy consumers - unless other consumers are exhausted. Also allows splitting up the batches of events when demand from multiple consumers is larger than events dispatched.