Re: [PHP4BETA] Database Connection Pooling
| From: | Cary Collett | Date: | Wed, 01 Mar 2000 19:47:55 +0000 |
| Subject: | Re: [PHP4BETA] Database Connection Pooling | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11281@lists.php.net to get a copy of this message | ||
Thus spake Manuel Lemos (mlemos@acm.org):
> >> AFAIK all supported databases have functions to establish persistent
> >> connections. They work on a per server process basis. That means
> >> persistent connections are kept until a server process lives, and
> >> each server process manages their own pool of persistent connections.
>
> >Assumption is the mother of all screw-ups. While PHP does support
> >persistent connections, those are per Apache process. What it needs is
> >a common connection pool for all Apache processes.
>
> If that is what it was meant, I don't think it is a good idea. One
> persistent connection per process is better than have Apache processes
> competing for database connections allocated from a common pool. The way I
> see it, that would impose needless latency in database connections.
>
I don't see why you would think that a connection per process is better.
Except for the case where EVERY hit requires a DB connection for handling
of the request, you will always have extra, resource consuming connections.
(Note that unless you have your MaxRequestsPerChild set very low, you
will eventually have a db connection in every Apache child.)
IMO, it would be better to have a pool of connections that you could tune
much the way the pool of Apache children is tuned.
Cary
--
Cary Collett cary@ratatosk.org
http://ratatosk.org/~cary
"To me boxing is like ballet, except that there's no music, no choreography,
and the dancers hit eachother." -- Jack Handy