Forum OpenACS Q&A: Re: Expected non-db overhead time on an OpenACS page?

Collapse
Posted by Don Baccus on
Tcl code resulting from template .adp files and their associated datasource .tcl files are wrapped by "proc ... uplevel {}", and that proc is then used forever after unless the files change.  So you should not be seeing a lot of time wasted in adp compiles.  If you are, I'd appreciate any effort you could make to figure out why, because I've poked into this on a Linux box in the past and have verified that proc caching works (and being wrapped in a proc, the Tcl compiler should only compile it once per thread, too)

You might want to instrument the code that does this to make sure it's not recompiling needlessly, just grep for mtime in acs-templating/tcl/parse-procs.tcl. If you are, I'd appreciate any effort you could make to figure out why, because I've poked into this on a Linux box in the past and have verified that proc caching works (and being wrapped in a proc, the Tcl compiler should only compile it once per thread, too)

If you have minthreads set low and maxthreads set high, a sudden flurry of connections after an idle period will trigger the spawning of new threads, and therefore new template compiles because the compiled proc code is only defined in the current thread context.  To maximize performance it is best to set minthreads=maxthreads at some reasonable number.  Thread initialization overhead isn't confined to the template system, all the procs defined in every package's library directory (/tcl) are recompiled also  when a new thread fires up.

Hmmm ... the more I think this the more I think this is probably the source of the problem, you've got minthreads set low and are respawning threads when you hit a flurry of connections.  Letting threads die is appropriate on a development box or if you're hosting a low-volume site on a box the serves up a variety of services, but not on a production site with any significant level of volume.

As far as raw speed goes, I've been doing some benchmarking to get some baseline data on the request processor.  On my new P4 2.4GHz machine with PC2100 DDR RAM, using AOLserver 4 in production mode and caching the read permission check, I get over 70 templated page views a second when loading it down with five tclwebtest scripts repeatedly viewing a very simple template that sets one var and displays it.  I get less throughput with a single connection, apparently connection latency plays a role.

AOLserver 4 seems to perform about 20% better than AOLserver 3 in this test (this is due to Tcl8.4.3 performance improvements, you can run that Tcl version with AOLserver 3, too)

Performance mode gets about 15%, permission caching on a basic install a few percent ...

Anyway ... 70 templated page views a second ain't bad on a $389 Dell box (of course you can't get that box for $389, nah nah nah!)