Many thanks; I think your changes did the trick. The requests per
second metric is now just cut in half executing six macros vs. executing
no macros, which seems like a reasonable reduction given the extra
processing needed. Unix stat() calls on the .pt files shows that they're
read once, not with every request.
Here are the numbers after getting revision 2536 of ZPTKit:
With macros:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Total transferred: 363285 bytes
HTML transferred: 347850 bytes
Requests per second: 87.87 [#/sec] (mean)
Time per request: 56.90 [ms] (mean)
Time per request: 11.38 [ms] (mean, across all concurrent
requests)
Transfer rate: 638.46 [Kbytes/sec] received
Without macros:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Total transferred: 369935 bytes
HTML transferred: 354195 bytes
Requests per second: 176.68 [#/sec] (mean)
Time per request: 28.30 [ms] (mean)
Time per request: 5.66 [ms] (mean, across all concurrent requests)
Transfer rate: 1307.19 [Kbytes/sec] received
Thanks again for the rapid response.
Cheers!
--
David Hancock | dhancock@... | 410-266-4384=20
-----Original Message-----
From: Ian Bicking [mailto:ianb@...
Sent: Saturday, May 21, 2005 12:58 PM
To: Hancock, David (DHANCOCK)
Cc: webware-discuss@...
Subject: Re: [Webware-discuss] ZPTKit and standard_template question
Hancock, David (DHANCOCK) wrote:
> Thanks for the ideas; I'll see if I can implement one or more (or get
> somebody smarter than me at work to help me).
>=20
> Regarding the 200:1 performance difference noted, I just checked
again,
> and got the same results. As Ian asked, I did a macros vs. no-macros
> comparison, and use ApacheBench to test.=20
OK, so it really is the macro that's causing the problem. Or, rather,=20
the use of fetching a template through "here". I'm pretty sure this is=20
because ZPTComponent keeps track of used templates, and returns them to=20
the pool once the request is through -- but it only knows about the=20
templates that are directly created through the servlet, not indirect=20
ones, so things like standard_template.pt are never returned to the
pool.
But I think I was just being too defensive with the pooling, I don't=20
think it's needed at all. I just committed changes to ZPTKit's trunk=20
(r2536) that reuse templates much more actively. I think I can actually
rip out large parts of templatetools and zptcomponent, but I just made=20
the minimal changes for now.
--=20
Ian Bicking / ianb@... / http://blog.ianbicking.org
|