Mark Stosberg wrote:

the different process_id (2461, 2780) means they are two different
connections ?

I think that's right.
I'm not a FastCGI user, but it's my understanding that you would need a
variable to be at least package-scoped for it to be share.

If I'm right, then something like this would stay shared:

our $dbh = DBI->connect(...);
$self->dbh_config($dbh);

But don't do that. It's just asking for problems. DB connections *will* go stale. If that happens your application will stop working with strange errors and only a restart will fix it. This is the problem that Apache::DBI solves for mod_perl. If you want to learn how to do this on your own, then I suggest looking in there for some pointers. But I will warn you that Apache::DBI doesn't do the magic on it's own. DBI knows about Apache::DBI. So any code you write yourself won't have that advantage.

I'd suggest asking on a more FastCGI specific forum to find out how others cache their DB handles. BTW, which RDMS are you using? If your using MySQL, then I'd say don't worry about it. Creating new MySQL connections is really fast and if that's a bottleneck in your application, then congratulations. OTOH if you're using Oracle, or even Postgres then connections are much more expensive, so you should be looking for a caching solution.

--
Michael Peters
Plus Three, LP


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to