[Templates] sharing memory under mod_perl

Stas Bekman stas@stason.org
Wed, 08 Oct 2003 11:38:53 -0700


darren chamberlain wrote:
> * Brad Bowman <template at bowman.bs> [2003-10-07 08:24]:
> 
>>The mod_perl guide has advice for loading CGI & DBI at
>>apache startup time to improve memory sharing.
>>
>>Does anyone have a similar snippet for TT2?
> 
> 
> Since version 2.55 (last November), Template.pm will preload all the TT2
> modules if it detects $ENV{MOD_PERL}.  This means that a simple
> 
>   PerlModule Template
> 
> In your httpd.conf will compile all the TT2 modules in the parent
> process.  You can also explicitly call Template::Config->preload() if
> you want.

That sounds like not such a good idea. What if not all modules are needed? In 
that case that will waste memory. Unless by 'all' you mean only the few that 
always get loaded.

The trouble with that approach is that it takes control from users. May I 
suggest a fine-tuned control with import, similar to what CGI.pm does?

   use Template -preload => 'all';

   use Template -preload => 'common';

etc...


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com