[Catalyst] Re: Where to put "use"

Aristotle Pagaltzis pagaltzis at gmx.de
Wed Feb 18 19:03:45 GMT 2009


* Jose Luis Martinez <jlmartinez-lists-catalyst at capside.com> [2009-02-18 15:35]:
> I tend to use Module::Load to load seldom used modules at
> runtime to reduce loading time and memory footprint.

This is counterproductive in a long-running, fork()ing server.

If you load all modules up front then they will only be loaded
once and each child processes will have a copy already loaded at
the time of fork(), which also means child processes will start
out sharing more memory with the parent (and therefore probably
with other children).

If you load the modules as late as possible, then each child
process will have to load the module separately and will not
share the necessary memory with any other process.

But you can use prefork.pm[1] to have your cake and eat it.

[1]: http://search.cpan.org/dist/prefork/

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list