14 messages in com.mysql.lists.perlRe: Maintaining State/Cached Connections
FromSent OnAttachments
Jason Allocco06 Jun 2001 08:13 
ed phillips06 Jun 2001 09:34 
Jeremy Zawodny06 Jun 2001 10:05 
Dodger06 Jun 2001 12:30 
Todd Finney06 Jun 2001 16:14 
Dave Rolsky08 Jun 2001 00:11 
Jochen Wiedmann08 Jun 2001 01:21 
Todd Finney08 Jun 2001 07:49 
Jochen Wiedmann08 Jun 2001 08:54 
Todd Finney08 Jun 2001 09:58 
Jochen Wiedmann08 Jun 2001 15:18 
Stas Bekman08 Jun 2001 21:36 
Jochen Wiedmann10 Jun 2001 07:04 
Stas Bekman10 Jun 2001 07:32 
Subject:Re: Maintaining State/Cached Connections
From:Stas Bekman (st@stason.org)
Date:06/10/2001 07:32:03 AM
List:com.mysql.lists.perl

Hi Jochen,

On Sun, 10 Jun 2001, Jochen Wiedmann wrote:

Quoting Stas Bekman <st@stason.org>:

Jocheh, your example could be correct if the parent process is the one that opens the connections. However this is not true: Apache::DBI->connect_on_init only registers a hook to DBI::connect() for PerlChildInitProcess phase. Which means that every time Apache spawns a new process, a *new* connection gets opened by this new child process. This connection is unique to each process, hence there is no problem.

This section of the guide is correct to my understanding and experience.

If that's the case, you are right, of course. However, I don't see the performance gain in that case? IMO this means, that even those child processes will open a database connection that never use it at all?

A first client to use the newly spawned child will have the connection open. That's the only real benefit. Usually all processes need the database connection at some point, if you have at least one app using it. On the heavily used site, it's obvious that all processes will need it then. Under mod_perl 2.0 you will be able to specify different pools of interpreters to do different things. That's when you can allocate a pool with database connections. Of course mod_perl is going to handle the connection pooling now and there will be no need for Apache::DBI anymore (unless you use the old forked MPM).