in reply to When does it make sense to preload modules when starting Starman?

preloading in general makes sense when you are able to amortize the upfront penalty from start up over the lifetime of the running application. So if you have a highly stable application that's never restarted, then it's probably worth a few minutes of "warm up" time at the start. If you're going to be restarting often or the preload is simply too much work for the reward, then you're better off lazily loading at runtime via require.

Update - I thought I should add what I knew to be true (at some point) and isn't a secret, cPanel pays people a a lot of money to maintain a build infrastructure that uses B::C to generate a binary from Perl simply to improve start up time of their administrative daemon, cpservd. Basically, many MBs of initializations and module loads are shoved into a BEGIN{}. The binary is the state of the perl start up through BEGIN (like what you get by invoking perl -c). My point is that this is also an option - if you have a lot of stuff to preload, B::C can be used to get you into a state where start up actually picks up after BEGIN.

Replies are listed 'Best First'.
Re^2: When does it make sense to preload modules when starting Starman?
by karlgoethebier (Abbot) on Oct 30, 2021 at 08:25 UTC

    Holy Joe! I just wanted to be on the Bright Side of Life.

    Something like starman -Mstrict -Mwarnings -MPlack::Request -MPlack::App::URLMap -MPlack::App::URLMap. If the syntax is so. Untested. "Fire up and forget about it" was the basic theme. But i guess that i'm forced to do some forensics. Sometimes some things go totally wrong with a good cause. I wrote a very friendly email to the author. Result: undef. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»