Page 1 of 1

a few questions concerning mysql_pconnect

Posted: Tue Apr 20, 2004 6:34 pm
by davidklonski
Hello

I have been reading about mysql_pconnect (persistent connections) and I am a bit confused from the problems they seem to cause people.

Here is what I understand:
If I use mysql_pconnect instead of mysql_connect, then used connections from the same host, username & password will not be thrown away after the child process of the web server (I am using Apache) is done with them. They will persist for a whlie before being garbaged.
This allows the child process to continue using the same connection if another request is made to the same host, username & password and the connection was still alive.

I understand that many people are complaining that the number of persistent connections keep getting larger and larger.
This is because the Web server spawns many child processes and each has its own connection.

Here is my question:
I all of the connections will be made to the same, username & password, can that problem still occur?

I also understand that MySQL can limit the number of open connections. Is there a way to tell it not to limit it and what the cosequences of that would be?

thanks in advance

Posted: Tue Apr 20, 2004 11:59 pm
by JAM
As far as I know, mysql_pconnect() is only good to use if you recieve a very high amount of hits (and with that, database accesses) to the site, and if the "wait_timeout" value is tweaked.

As i never myself use anything else than mysql_connect() I cannot comment wisely, but this; http://jeremy.zawodny.com/blog/archives/000173.html might be abit interesting to erad (?).