Re: mysql_pconnect()

From: Date: Tue, 04 Jul 2000 00:05:15 +0000
Subject: Re: mysql_pconnect()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4610@lists.php.net to get a copy of this message
In article <395A736D.65470FF9@wwcd.com>, victord@wwcd.com (Victor) wrote: > Can any of the developers explain how mysql_pconnect() works? > Is the connection persistent only for the httpd child that connected or > can it be used by any child as long as the connection is for the same > user with same password ? > If so, how is the connection closed afterwards ? As I understand it: One HTTP child gets a connection, and holds on to it. If the next mysql_pconnect() through that child is for the same server, same user, same password, then it reuses it. If not, it closes it and makes a new one. The last connection opened for that child is open until that child dies, or until some other connection is requested. In other words, no, the children do not "share" their connections. A "pool" of connections for the children to grab and release as needed by the parameters passed in to that child at any given time would be pretty nifty, but then the question of when connections would close comes into play, as well as significantly more complex code about locking/releasing connections, not to mention the pool manager that creates connections to start with... Be even nicer if the pool could be spread across a cluster, maybe even with controls for how many of the connections could be given to any cluster at any time or other fine-tuning settings... I assume the PHP/MySQL Developers have considered doing something like this, but I imagine it turned out to be a bit too much effort for the first design. No comment either way about what future designs might look like :-) Feel free to implement it yourself and donate it to the PHP community. :-) -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#4610) next »