I was looking into why our server's restarts take so long, and I
finally remembered that Apache runs its initialization step twice on
startup (http://tinyurl.com/krr25). This means that my startup.pl is
loaded twice, along with any modules that it loads.
So I moved startup.pl to startup_real.pl and put this in startup.pl:
# Only run our real startup script the second time.
#
use Apache2::ServerUtil ();
if (Apache2::ServerUtil::restart_count() > 1) {
require 'startup_real.pl';
}
And it shaved a bunch of time off our restart.
As I understand it, the sole purpose of this double initialization is
to make sure that graceful restarts will work. However, since I was a
young mod_perl lad I've been taught never to rely on graceful
restarts, and always to stop/start.
If I don't ever plan to use graceful restarts, and I believe that
smaller restart times are an unqualified Good, is there any reason why
I shouldn't ALWAYS use a script like the above? And is there any way
to avoid PerlModule modules from being loaded twice?
Thanks
Jon