Hancock, David (DHANCOCK) wrote:
> I'm working with ZPTKit so I can use Zope Page Templates with Webware,
> and functionally things are going well. I'm seeing a performance
> problem, and hope that someone can point me in the right direction from
> My setup is Webware 0.8.1 plus ZPTKit and Zope Page Templates, with a
> very simple template Routes.pt that uses macros and slots defined in
> standard_template.pt. There's almost nothing in the corresponding
> Routes.py file. If I restart WebKit, then hit the Routes page, the
> "accessed" time (as reported by stat) reflects the current time. From
> then on, if I hit the page again, the Routes.pt file retains it accessed
> time--that is, it appears not to have been reread. That's a Good Thing,
> performance-wise. However, the standard_template.pt file DOES get its
> accessed time updated with each request for the page, and this seems to
> be killing performance.
I never looked that closely, but that seems to be because the first
template is going through templatetools.TemplatePool, while 'here'
builds objects directly from templatetools.FileTemplate, which reads a
fresh copy off the disk each time. Actually, I don't think TemplatePool
is even needed, I think PageTemplates are threadsafe. Maybe the whole
thing could be simplified by simply overriding FileTemplate.__new__ so
that it didn't return new instances if one already existed for a given
> Using 'ab' and a 2K static HTML page, my system can serve about 200
> requests per second. Using ZPTs, ZPTKit, standard_template.pt and
> Routes.pt, I get about 1 page per second.
1 page per second...? I admit I might miss performance issues, but I'd
be surprised if I missed an issue that large. What's the difference
between a template with a macro and one without?
Ian Bicking / ianb@... / http://blog.ianbicking.org