On Tue, Mar 13, 2012 at 3:51 PM, Dan Axtell <daniel.axt...@snet.net> wrote:
> I understand the value of having one light-weight server for static content,
> and a reverse proxy back to a heavy-weight Apache with mod_perl, and I
> understand I can use something like Varnish or mod_cache to add a caching
> layer,  but I'm wondering if there is much if any value to caching templates
> at the application level.

Well, it makes your page generation faster.

> The apps are mostly dynamic forms based on HTML::Template.  H::T has some
> caching options but they seem more aimed at CGI users.  I could convert to
> Template::Toolkit, which as I understand converts to compiled Perl code (which
> would presumably mean that mod_perl would leave the template objects in
> memory).

Performance is pretty similar between the two and converting to
Template Toolkit would be a big job, so I'd suggest you stay with
HTML::Template unless there's some other problem you're having with
it.

> So does anybody recommend going down to the application level to cache
> templates (either by tinkering with HTML::Template or trying to pre-load TT
> objects), or is there more bang for the buck by focusing on the server level?
> Or is both the way to go?  Not sure where diminishing returns kicks in.

Turn on the template caching.  It's basically free and will speed
things up.  Caching at the page level is the ultimate in terms of
speed, but it will only be possible for pages that are not dynamic on
a per-user basis.  Template caching helps everywhere.

- Perrin

Reply via email to