[cgiapp] cached DBI connections with cgiapp/fastcgi
Benjamin Hitz
hitz at genome.stanford.edu
Fri Oct 24 12:37:53 EDT 2008
>> This was done long before I was aware of C::A::Dispatch. This works,
>> it's just too slow (for various reasons).
>
> Do you mean the conversion process is too slow or that
> C::A::Dispatch is
> too slow?
>
> The former, surely.
Actually neither. The vanilla CGI:App is too slow. There is allot of
overhead
to add CGI::App + TT etc. Well... OK, it's not MUCH slower, but we
also added some new
modules that use DBIx::Class... and on a 120 table database THAT is
slow to load (2sec).
Dumping DBIx::Class would also be an option, but it's still not
particularly zippy with plain CGI/
(main page does ALOT of queries, and they are often quite complicated)
>
>> So I am just now trying to patch this to run under fcgi, because from
>> my poking around this would require
>> less rewriting of the code I already have (vis-a-vis mod_perl).
>
> Another approach is to clean up any usage of global variables, and to
> then run them all as registry scripts (mod_perl on-the-cheap, so to
> speak).
Will consider this. The only globals are:
a) a couple of constant hashes
b) a bunch of "use constants"
a) C::A::P::TT->tt_config*
Can you leave global constants here, I do I have to shove them into
the object?
* I call tt_config as a class method as recommended in the POD section
"SINGLETON SUPPORT".
It mentions:
"So to improve the efficiency of Template Toolkit, we should keep the
object (and hence all the compiled templates) in memory across
multiple requests. This means you only get hit with the startup cost
the first time the TT object is created"
But I don't see how putting this in the superclass actually does this,
in a vanilla (NON CACHED) CGI app where a C::A object is instantiated,
->run() and then destroyed. What difference does it make under
namespace the tt object exists? Assuming you don't run tt_config at
each level of the hierarchy (which you would have to be pretty silly
to do)
As a point of clarification, most of the relevant C:A objects are in
my system are:
WWW::Reports::LocusReport::LocusSummary ISA LocusReport
WWW::Reports::LocusReport:: ISA Reports
WWW::Reports ISA CGI::Application
yay extraneous plural!
So is the "singleton support" comment only relevant in a cached env
like mod_perl or FCGI?
>
--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO
Consortium
Stanford University ** hitz at genome.stanford.edu
More information about the cgiapp
mailing list