-
Notifications
You must be signed in to change notification settings - Fork 183
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
Throttling of queues #178
Comments
@mabeebam You are right, it can be implemented as a new middleware. I think that the middleware should be similar to sidekiq-throttler gem implementation. |
@sineed @akira Thanks for pointing out sidekiq-throttler. I had a look at it and the following issue I also had look at a gem The gem @sineed @akira How would you realize throttling of queues (with 100.000+ jobs) via unsubscribing and subscribing them (scheduled after some time) when certain throttling params are exceeded? Still as middleware? Any other ideas? Thanks! |
If we wanted to avoid the fetching and re-queuing we can potentially implement some "server-side" middleware that would limit the available queues. Right now it limits it based on free workers, but it could also apply other rules so that those queues never even get popped if they are limited further by the other middleware. Spot where we are limiting it currently: https://github.com/akira/exq/blob/master/lib/exq/manager/server.ex#L246 |
I got an implementation more like the sidekiq-throttler. Already pushed to my forked but haven't submit a PR request yet since there are still some polishing and testing need to be done. If you are interested, you can go to https://github.com/wli0503/exq to check it out. @akira If you got some time, can you take a look at the implementation and tell me how you think about it? Thanks a lot for you time and I am looking forward to hear from you! |
@wli0503 I think for utilities like this I would prefer it to be an external package - and you can include it in your project. Does that work for you? You can do a separate pull request for the Exq changes in the files:
as those look ok to be in Exq. |
@akira Thank you so much for taking time reviewing my commit! Yes, I can definitely do that. Once I'm ready I will submit a separate PR for modifications into Exq and keep the throttler as an external package like we discussed. Really appreciated! |
Hey @wli0503, I'm wondering, did you have time to polish your implementation? |
@StanBright Not really. After I did the first implementation I realize that It might not suit my needs as intended, so I have to leave it for now. |
How would I trigger this middleware from a job? |
Closing this, as we have added the ability to do this on master branch. Examples can be found at https://github.com/ananthakumaran/exq_limit |
Hi,
First of all: Thanks for exq, it is great!
Is throttling of queues (e.g. only x job executions per minute/hour per queue) a feature that will be supported by exq in the future? How would one model throttling in exq? Middleware
before_work
,after_processed_work
,after_failed_work
?Any ideas or opinions welcome! Thanks in advance!
Cheers!
The text was updated successfully, but these errors were encountered: