-
Notifications
You must be signed in to change notification settings - Fork 79
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
Jobs randomly changing position only if throttle is used #86
Comments
I just bumped on #52 So this appears to be by design :) Closing. |
@feliperaul can you point me out where Sidekiq guarantees that jobs are going to be fetched in order? Because if it is so - we need to think on how to make sure we follow that. |
Hi @ixti , sure. It's on the FAQ, here: https://github.com/mperham/sidekiq/wiki/FAQ#how-can-i-process-a-certain-queue-in-serial It reads:
To be quite honest, it hasn't been a big deal for us, but if #52 states that the job queue, when throttled, is paused from polling for two seconds, I think that it would be much better to push the jobs back to the top of the queue, instead of pushing them back to the end of the line. Imagine a huge e-mail sending queue (like 100.000 jobs) that you are throttling to use only 5 workers ... if jobs are being pushed to the END of the queue, they would take much, much longer to send than if they were pushed back to the top of the queue to wait for the next poll window (2 seconds). |
I think there's no one size fits all solution. But we can make throttling as customizing as possible:
I'll be happy to review and merge any improvements. |
Ruby version: 2.6.5
Sidekiq / Pro / Enterprise version(s): 6.0.7
Initializer:
We are currently inspecting a queue that is taking a long time to run ("importers").
On investigating, we noticed a very unusual behavior that we think is a bug and might be causing performance degradation and/or unexpected behavior.
If we activate "Live poll" and watch the queue on the web ui, every 2 seconds we have a completely different order of jobs, even tough no new jobs have been added and no jobs have been processed (these jobs take a few minutes each, and they only receive jobs manually, so it should be very stable during processing).
Using Rails console to inspect it further, we could confirm that on every poll (a few seconds apart), we get a completely different array of
job.jids
, even tough all the Job Ids remain the same (only the order changes, but the jobs ids remain constant, so no new jobs are being added or removed).We're using this debug code to confirm the order is changing very rapidly:
This is the result:
AFAIK, Sidekiq guarantees that jobs are going to be fetched in order (even tough, of course, it's an Async job queue, so there's no guarantee they will finish in the order they were added), so we think this to be a bug.
The text was updated successfully, but these errors were encountered: