Hello,
when you boot Foreman in production, eager_load configuration value is turned on therefore all application classes are loaded. However this is not enabled therefore many classes loads as they are needed, most of them during the initial request.
Here is a problem - we have some features which lists all classes (e.g. descendants of a class) during boot. This creates situations when Foreman does not behave the same as in production and it can lead to confusion for users who don’t know about this problem. For example, when working on Subscription API (Foreman events and webhooks), you actually need to turn on eager_load to be able to do anything reasonable.
I hereby propose to turn on eager_load for development environment.
In my testing, Foreman boots up in 10 seconds without eager_load and in 15 seconds with it. That’s 50 % slower boot. I know it’s much to ask, before you stop reading keep in mind that initial load of a page (Hosts list) is 25 seconds without and 22 seconds with eager_load on my Foreman. If you put this into the context:
- currently: 10s + 25s = 35s end to end load time before you see a rendered page
- the proposal: 15s + 22s = 37s end to end load time before you see a rendered page
Now that’s not that bad considered the advantages we can get. But I am not stopping here, I created a patch that postpones loading of all gettext locales to the point when user actually needs them. This shaves off 2 seconds off the boot time in development. This puts the total boot time on my system back to 35 seconds.
Let me know what you think and please someone measure your boot times with and without the option in question to validate my numbers.