From: Hancock, D. \(DHANCOCK\) <DHA...@ar...> - 2005-05-21 03:35:47
|
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 here. 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. 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. How can I get standard_template.pt read ONCE at startup and get back up to a reasonable number of requests per second? Cheers! -- David Hancock | dha...@ar... | 410-266-4384=20 |
From: Ian B. <ia...@co...> - 2005-05-21 05:51:15
|
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 > here. > > 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 filename. > 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 / ia...@co... / http://blog.ianbicking.org |