-
Notifications
You must be signed in to change notification settings - Fork 361
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 thread based delayed workers #3887
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
johha
force-pushed
the
delayed-worker-threads
branch
from
July 26, 2024 09:55
e89734a
to
61d2742
Compare
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Jul 26, 2024
3 tasks
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Jul 26, 2024
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Jul 26, 2024
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Jul 26, 2024
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Jul 26, 2024
philippthun
reviewed
Aug 6, 2024
Samze
reviewed
Aug 6, 2024
Samze
reviewed
Aug 6, 2024
johha
force-pushed
the
delayed-worker-threads
branch
from
August 7, 2024 06:32
61d2742
to
96a8251
Compare
johha
force-pushed
the
delayed-worker-threads
branch
3 times, most recently
from
August 19, 2024 14:32
49b63f5
to
635c570
Compare
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Aug 19, 2024
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Aug 19, 2024
johha
force-pushed
the
delayed-worker-threads
branch
from
August 20, 2024 09:16
e5b8ea8
to
49b799b
Compare
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Aug 21, 2024
johha
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Aug 21, 2024
johha
force-pushed
the
delayed-worker-threads
branch
from
August 21, 2024 15:57
661614c
to
4fb1e59
Compare
Samze
previously approved these changes
Aug 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
philippthun
reviewed
Sep 2, 2024
philippthun
reviewed
Sep 2, 2024
Co-authored-by: Johannes Haass <[email protected]>
Co-authored-by: Johannes Haass <[email protected]>
Co-authored-by: Johannes Haass <[email protected]>
In the event of an unexpected error in a thread, this change ensures that all other threads that are still running will get a graceful shutdown period of 30 seconds (like monit). After that, the remaining threads are killed and the threaded worker process will fail with an exception. This ensures that monit can restart the failed process. DelayedJobs already handles all possible errors during job execution, so the graceful shutdown is only applied to errors that occur after a job has finished. Co-authored-by: Johannes Haass <[email protected]>
Co-authored-by: Johannes Haass <[email protected]>
Co-authored-by: Johannes Haass <[email protected]>
Co-authored-by: Johannes Haass <[email protected]>
johha
force-pushed
the
delayed-worker-threads
branch
from
September 3, 2024 08:30
4fb1e59
to
496be60
Compare
philippthun
reviewed
Sep 3, 2024
philippthun
approved these changes
Sep 3, 2024
ari-wg-gitbot
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Sep 3, 2024
Changes in cloud_controller_ng: - Add thread based delayed workers PR: cloudfoundry/cloud_controller_ng#3887 Author: Johannes Haass <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently operators can configure the number of delayed job workers for the generic queue with two parameters:
number_of_workers
)Most delayed jobs however are limited by I/O (e.g. database queries) and don't do a lot of processing in ruby.
To increase the throughput on a single worker VM while reducing resource consumption (threads vs processes) this change introduces the option to run multiple delayed worker threads in a single process.
The number of workers calculates like this:
num_cc_workers X number_processes X num_threads
Tests comparing 8 worker processes versus 8 worker threads show that the throughput is the same while the memory consumption is ~60% lower. Allowing operators to run more workers on a single VM.
All threads have a graceful shutdown period of 30 seconds (like monit) so that long running jobs have a chance to finish.
In case a thread crashes with an error a graceful shutdown is triggered and the whole process will exit with an error. Delayed::Job already catches all errors during job execution (https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/worker.rb#L241-L244).
Links to any other associated PRs
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests -> Tested on a bbl env