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
Do not enable preloading by default #2483
Comments
I think rolling back the code might be the right call or at least we need to make this very clear in the 5.x upgrade docs (like you already proposed in #2481). The change in #2143 was probably meant to be basically backwards-compatible with puma 4.x: if your application was using phased restarts, then you already had I think that logic is based on the false premise that if you don't have |
I agree. One additional thing here is that you can't figure out if you configured Puma correctly to allow phased restart until you actually try to phased restart it. Possible ideas:
Now that this is shipped on master, a simple revert will also break anyone who is depending on the new functionality to cause |
I think we should make phased restart users "opt-in" to a configuration option that signals they want to be sure, before boot, that their processes will respond correctly to a phased-restart signal. We thought The 5.0 change implicitly turned off phased-restart by default. We should document that, and then add a new DSL option, Maybe in the future this option can do some smart checking/recommendation to tell the user if they need prune_bundler. |
Also I think preload_app! being set only if WEB_CONCURRENCY was set was a mistake. It should be on by default if using cluster mode by any means. |
Okay, so we still want Should we make the signal for phased-restart ( I'm raising this discussion about going forward with |
Oh definitely not, I could've been more clear here: this would be done for Puma 6.
Hmmm... no. I'll make a PR. |
Actually, now that I think about it, I think what I'm really proposing is to keep things as-is but document/encourage usage of Once Puma 6 rolls around, make |
One thing that is kinda awkward about phased restarts as they're implemented right now is that phased restarts are not inherently incompatible with Lines 203 to 204 in 5af91ff
If we instead just changed that behavior in More concretely, if you were a user that wasn't explicitly opting-in to If you were a user that was opting into The only problem would be that if you were a user that did opt into If we made this change in puma 5.x now, it would mean that we can keep the preload-by-default behavior (and perhaps more importantly, we can confidently fix it so that it works when setting |
I should say, too, that I don't know if I'm 100% an advocate of the solution I proposed in the previous post. Just wanted to present it as an option. So far it seems that these are these options
If we do decide to do a puma 6.x, we can take the opportunity to carefully consider all of our options we have with regard to what the best configuration experience would be for our users. |
I think we fix this by making clear what we didn't in the Puma 5.0 upgrade docs: to get phased restarts, you must The bottom line here is that a significant portion of the userbase runs cluster w/o needing phased restarts. Those people should get opted-in to preload_app. If you want phased restarts, you need to opt in to that instead. We changed who needs to opt in to what incompletely in Puma 5, and that's my mistake. It should have been a complete shift. We already log whether or not phased restart is available on boot, but I think we could make it clearer by logging slightly differently:
Part of the UX problem here is that if phased restart is NOT available, we don't say anything. In this new logging I propose, you would see:
Maybe we can do something even cleverer with emoji or something to make it even clearer:
|
I like the emoji log a lot but I want to be sure there aren't any major issues/incompatibilities with logging emoji before I decide to commit that. |
I asked on Twitter and apparently some people don't like emoji in their logs. So maybe more like:
Dingbats, yay! |
I think we should revert this code from #2143
puma/lib/puma/configuration.rb
Lines 149 to 151 in 7aa62c7
The idea for Puma 5 was to make
preload_app!
the default, but it is only true if you useWEB_CONCURRENCY
to configure the number of workers (because this code runs before we have loaded the config file).We can of course fix this, but I'm not so sure it is a good idea. From the issues, it seems like using phased restarts is popular, and enabling
preload_app!
breaks phased restarts (Puma restarts normally instead). It would also make the defaults a bit strange, out of the box, phased restarts would only be available when using 1 worker (#2481).The text was updated successfully, but these errors were encountered: