-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 RAILS_MIN_THREADS, RAILS_MAX_THREADS, set default worker, preload… #2143
Conversation
… if using workers
My guess on test failures would be that they're related to the change of changing the default from single mode to cluster mode, which I'm not even sure is a good idea. |
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.
Is cluster mode enabled changing the number of workers from 0 to 1 ?
I liked the PUMA_MIN_THREADS naming. Would it be easier to create this PR if it was only about the ENV vars, and left out the other stuff? Could make this change smaller and easier to review. PS: this is awesome, thanks for taking the time to work on it! |
I'm fine with the size-factor of this PR. Need to think about the Single vs Cluster for MRI thing. |
Regarding "changing the default from single mode to cluster mode", I assume it would be a change for Puma 5, but nonetheless I guess the |
OK. Let's keep Puma in singlemode by default. No need to force cluster by changing workers to 1. With that plus the other changes outlined above, LGTM. |
FYI: test/test_config.rg:43 is a flaky test. I need to research this more, but randomly config returns 2 instead of 0. I'm not sure if that is coming from a test helper or something |
Builds failing with |
@nateberkopec @ukolovda It looks like truffleruby does not support forking. Does this mean that truffle also does not support workers? |
@@ -109,7 +109,7 @@ def in_background(&blk) | |||
end | |||
|
|||
def workers_supported? |
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.
This method feels like it should be in the lib/puma/detect.rb
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.
@@ -109,7 +109,7 @@ def in_background(&blk) | |||
end | |||
|
|||
def workers_supported? | |||
return false if Puma.jruby? || Puma.windows? | |||
return false if Puma.jruby? || Puma.windows? || Puma.truffle? |
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.
should we check ::Process.respond_to?(:fork) as well?
Does that single check eliminate the need to check for jruby/windows/truffle?
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.
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.
Fixed in my nitpick commit. Thanks for the work on this PR!
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.
Sweet!
Hi folks! Is there a reason to set I couldn't find the why in the discussions or related issues. |
@fabioperrella long version: https://www.speedshop.co/2020/05/11/the-ruby-gvl-and-scaling.html short version: high threadcounts increase contention for the GVL. too much GVL contention == increased latency. |
@nateberkopec Thanks for that resource :) @fabioperrella I was going to mention, from https://github.com/puma/puma/blob/master/5.0-Upgrade.md#upgrade:
|
great, tks!! |
The default changed in Puma 5 with puma#2143.
This is what happened in puma#2143.
* Correct test name * Update preload_app! comment in dsl.rb The default changed in Puma 5 with #2143. * Upgrade guide: make it more clear about preload and phased restart * Clarify when preload_app! is on by default * Remove trailing whitespace * Upgrade guide: what setting WEB_CONCURRENCY does This is what happened in #2143. Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
The default value was changed in puma#2143
See https://github.com/puma/puma/blob/v5.2.2/lib/puma/dsl.rb#L615-L623 The default changed in Puma 5 with #2143. Docs later updated in #2481.
See https://github.com/puma/puma/blob/v5.2.2/lib/puma/dsl.rb#L615-L623 The default changed in Puma 5 with #2143. Docs later updated in #2481.
The default value was changed in puma#2143
See https://github.com/puma/puma/blob/v5.2.2/lib/puma/dsl.rb#L615-L623 The default changed in Puma 5 with puma#2143. Docs later updated in puma#2481.
… if using workers
Description
closes #1949
Please describe your pull request. Thank you for contributing! You're the best.
Your checklist for this pull request
[changelog skip]
the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.