[cgiapp] use persisten instance of cgiapp with cgi::fast?
Michael Peters
mpeters at plusthree.com
Mon Jul 19 10:46:43 EDT 2010
On 07/19/2010 10:09 AM, Dietrich Streifert wrote:
> I think most of the performance penalty comes from the DBI-handles which
> are not kept open between the requests. Every instance opens two
> DBI-handles which are used frequently during runmodes.
You really should benchmark it to see where the time is spent. "I think"
is a bad way to go about performance improvements :) I'm almost always
surprised to find out what my real bottlenecks are.
Having said that, DB handles may or may not be real problems. MySQL for
example can create new DB handles quickly and with very little overhead.
Oracle on the other hand is very expensive.
If you do find (Devel::NYTProf, hint, hint :) that you application would
benefit from persistent DB handles take a look at DBIx::Connector. It
handles that for you and would fix the problem of stale DB handles that
people usually encounter when they try to do it themselves.
> There are also some big hashes being initialised
Can you move this to compile time and initialize them at the class level?
> as well as more than 50
> runmodes being setup each time.
A hash of 50 items is almost negligible in the time it takes to initialize.
> Additionally there is a reopen of STDERR
> into a file in cgiapp_init which is called on every new instance but
> only once if the instance is reused.
I don't know how much of a speed hit that would be but I doubt it's
much. Again, profile, profile, profile and you'll most likely be
surprised where your real bottlenecks are.
--
Michael Peters
Plus Three, LP
More information about the cgiapp
mailing list