[cgiapp] use persisten instance of cgiapp with cgi::fast?

Mark Rajcok mrajcok at gmail.com
Wed Sep 1 10:22:26 EDT 2010


On Mon, Jul 19, 2010 at 10:46 AM, Michael Peters <mpeters at plusthree.com> wrote:
> 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.
>
Trying to catch up on email here... (hence the response to a month-old email):

When playing with Fast-CGI a while ago, I used DBI->connect_cached()
in my call to dbh_config() to get cached DB connections under
Fast-CGI, as described here:

https://docs.google.com/Doc?docid=0AY-OcCA2-lySZGQzNjNmZzlfNzdnYjRoZGg3Yg&hl=en#FastCGI_8880821961767984

At the time, I'm pretty sure I added some test code to prove to myself
that the connections were being reused/cached.

-- Mark


More information about the cgiapp mailing list