Re: [Templates] Server load skyrockets as soon as newer template gets installed

[prev] [thread] [next] [Date index for 2005/01/24]

From: Perrin Harkins
Subject: Re: [Templates] Server load skyrockets as soon as newer template gets installed
Date: 17:20 on 24 Jan 2005
[Please keep it on the list...]

On Mon, 2005-01-24 at 14:08 +0100, Tobias Begalke wrote:
> We use rsync -t so the time stamps of unchanged files are being
> preserved. I've managed to track down the problem to one file that's
> included in virtually every template. As soon as said file is uploaded
> all apache processes try to compile the template simultaneously. The
> question is why all that memory gets allocated and free'd over and
> over...the amount of memory is slightly larger than the size of the
> updated template so to me it looks as if we're dealing with a file
> locking issue or something in that direction

It sounds like perfectly normal behavior to me.  The file must be loaded
into a scalar, which takes more memory than the size of the file on
disk, and then it has to be parsed and turned into perl code, which
takes more memory, and then it has to be compiled into perl opcodes,
which takes more memory.

> Any ideas?

You could compile your templates off-line and move the compiled code to
your production server.  The perl code would still need to be compiled
by each process, but it would save you at least one step and probably
some memory when you update templates.  Personally, I normally bounce
the server when I update templates because I worry about the shared
copy-on-write memory getting fragmented.

- Perrin


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Server load skyrockets as soon as newer template gets installed
Perrin Harkins 17:20 on 24 Jan 2005

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52