Re: mysql_pconnect / persistent database conections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Edwards wrote:

Been meaning to investigate persistent database connections for a
while. Coming from a rdbms background (oracle with a bit of whatcom
sqlanywhare) I have always felt that the overhead of opening a
connection at the beginning of each page was a little resource
intensive.


MySQL is not remotely the same beast as oracle - take pure session create times. I have a machine that runs both. Creating an oracle session with sqlplus command line takes in the region of 2 seconds (get around this for web apps by connection pooling). Creating a mysql connection (c client) takes in the region of 5 mS.
You also need to consider the memory / processor implications of caching connections (or keeping persistent connections) from your web server.


Anyway, I found mysql_pconnect and this sounds like just the ticket. Seems that I can just change my connect method from mysql_connect to
mysql_pconnect and it will just work.


I do have a couple of questions.  Firstly what is the story with
mysql_close.  There is no mysql_pclose.  I guess you don't need to
close the connection at the end of each page but what if you do.   Is
mysql_close ignored if the connection was made with mysql_pconnect or
douse it close the connection and next time mysql_pconnect is run it
reconnects causing no benefit over mysql_pconnect.  also what is the
timeout likely to be?

My other question is what happens if lots of people connect using the
same user/password.  I tend to do my own user management so everybody
douse.  Is doing my own user management really dodge, if we were
talking about oracle I would probably say it is.

Ben



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux