Mailing List Archive

Is it possible to have fastCGI keep persistent database handle?
All, good day.

With fastCGI, I can achieve persistent script so I can save loading time,
but I find that I don't have persistent dbi handle? Each time the
application runs, database also opens a fresh handle.

Search on net, people say Apache::DBI can do the job, but I found mod_perl
is its prerequisite.

Is it really possible to have persistent DB handle with Perl/fastCGI? My
environment is Windows, SQL server, Perl.

Many many thanks.

Joe
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
Use DBIx - it uses lazy initialization - connects on the first
requests and mantains persistent connection

2011/2/15 Joseph He <joseph.he.2008@gmail.com>:
> All, good day.
>
> With fastCGI, I can achieve persistent script so I can save loading time,
> but I find that I don't have persistent dbi handle? Each time the
> application runs, database also opens a fresh handle.
>
> Search on net, people say Apache::DBI can do the job, but I found mod_perl
> is its prerequisite.
>
> Is it really possible to have persistent DB handle with Perl/fastCGI? My
> environment is Windows, SQL server, Perl.
>
> Many many thanks.
>
> Joe
>
> _______________________________________________
> Catalyst-dev mailing list
> Catalyst-dev@lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
>
>

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
On 15 Feb 2011, at 18:35, Boris G. Kolesnikov wrote:

> Use DBIx - it uses lazy initialization - connects on the first
> requests and mantains persistent connection

You mean DBIx::Class, or DBIC for short.

DBIx is a namespace for DBI extensions comprising tens of different
projects...

Cheers
t0m


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
Yes, that's what i mean, or either you use mysql reconnect flags and
global instance before entering the request loop

2011/2/16 Tomas Doran <bobtfish@bobtfish.net>:
>
> On 15 Feb 2011, at 18:35, Boris G. Kolesnikov wrote:
>
>> Use DBIx - it uses lazy initialization - connects on the first
>> requests and mantains persistent connection
>
> You mean DBIx::Class, or DBIC for short.
>
> DBIx is a namespace for DBI extensions comprising tens of different
> projects...
>
> Cheers
> t0m
>
>
> _______________________________________________
> Catalyst-dev mailing list
> Catalyst-dev@lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
>

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
Joseph He wrote:
> With fastCGI, I can achieve persistent script so I can save loading time,
> but I find that I don't have persistent dbi handle? Each time the
> application runs, database also opens a fresh handle.
>
> Search on net, people say Apache::DBI can do the job, but I found mod_perl
> is its prerequisite.
>
> Is it really possible to have persistent DB handle with Perl/fastCGI? My
> environment is Windows, SQL server, Perl.

Use DBIx::Connector, http://search.cpan.org/dist/DBIx-Connector/ , which is the
best solution on CPAN for this issue. It works properly for both FastCGI and
mod_perl and anything else, taking care of any gotchas. It is also simple and
can be used with plain DBI, no ORM baggage required, or it works with ORMs too,
so either way you have a choice. -- Darren Duncan

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
What's the difference with the usual DBIx? It keeps permanent
connection throught all your fastcgi process

2011/4/5 Darren Duncan <darren@darrenduncan.net>:
> Joseph He wrote:
>>
>> With fastCGI, I can achieve persistent script so I can save loading time,
>> but I find that I don't have persistent dbi handle? Each time the
>> application runs, database also opens a fresh handle.
>>
>> Search on net, people say Apache::DBI can do the job, but I found mod_perl
>> is its prerequisite.
>>
>> Is it really possible to have persistent DB handle with Perl/fastCGI? My
>> environment is Windows, SQL server, Perl.
>
> Use DBIx::Connector, http://search.cpan.org/dist/DBIx-Connector/ , which is
> the best solution on CPAN for this issue.  It works properly for both
> FastCGI and mod_perl and anything else, taking care of any gotchas.  It is
> also simple and can be used with plain DBI, no ORM baggage required, or it
> works with ORMs too, so either way you have a choice. -- Darren Duncan
>
> _______________________________________________
> Catalyst-dev mailing list
> Catalyst-dev@lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
>

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Is it possible to have fastCGI keep persistent database handle? [ In reply to ]
On 6 Apr 2011, at 08:23, Boris G. Kolesnikov wrote:

> What's the difference with the usual DBIx? It keeps permanent
> connection throught all your fastcgi process

There is no such thing as 'the usual DBIx'..

DBIx stands for 'DBI eXtension', and there are tens, if not hundreds
of modules on the CPAN which extend DBI.

Assuming you mean DBIx::Class, then the answer is none - IIRC
DBIx::Connector was extracted from DBIx::Class just so that people who
didn't want the full ORM could still have and reuse the persistent
connection and reconnect logic.

Cheers
t0m


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev