Skip to content
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

Fix to isolate the sidekiq process that runs the scheduler job #15314

Conversation

noellabo
Copy link
Contributor

Fix #14764

Introduce a scheduler queue that runs the scheduler job so that only the sidekiq process that processes this queue runs the schedule.

In the case of a single sidekiq process, everything is processed, including the schedule, as before.

bundle exec sidekiq -c 25

If you have multiple sidekiq processes running, only the process that handles the scheduler queue handles the schedule.

bundle exec sidekiq -c 25 -q defalut, 6 -q mailers, 2
bundle exec sidekiq -c 25 -q push, 4 -q pull -q scheduler

For existing configurations with multiple sidekiq processes running explicitly in the queue, this change prevents scheduled execution because there is no process to handle the scheduler queue.

bundle exec sidekiq -c 25 -q defalut, 6 -q mailers, 2
bundle exec sidekiq -c 25 -q push, 4 -q pull

The solution is to have one of the processes process the scheduler queue, or add a dedicated process for scheduled execution.

bundle exec sidekiq -c 5 -q scheduler

@noellabo noellabo force-pushed the fix-to-isolate-process-that-runs-the-scheduler-job branch from 36696c1 to b37b3a0 Compare December 14, 2020 11:59
@Gargron
Copy link
Member

Gargron commented Dec 14, 2020

With this change I believe locks can be taken out of the scheduler classes

@Gargron Gargron merged commit a2ef002 into mastodon:master Dec 15, 2020
@RobPurcellUK
Copy link

Just upgrading to 3.3.0 from 3.1.3 and I noticed the new queue. How do you see this working if running multiple instances in containers (k8s cluster)?

Running multiple instances of the streaming api, web and sidekiq processes for resilience and performance takes a hit here, as we need a single dedicated instance for the scheduler.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More than one scheduler job run in multi-host setups
3 participants