Re: need mysql_ping when using mysql_pconnect?

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

 



Quoting Richard Lynch <ceo@xxxxxxxxx>:

On Tue, August 7, 2007 3:58 am, lists@xxxxxxxxxxx wrote:
Just becasue you create a persistent connection it can still go down,
can't it? So therefore using mysql_ping inside of scripts with plenty
of idle time is useful?

It can still go down, for sure.

Using mysql_ping to see if it's still up at any given moment, though,
is probably a bad idea.

It can STILL go down between mysql_ping() and whatever (real) work you
want to do with mysql.

So you STILL need the same level of error-checking on your actual real
work statements.

So the ping is mostly just a waste of bandwidth.

There might be a specific use-case of 'mysql_ping', such as some kind
of "heartbeat" script that sends you an email if mysql has been down
for more than X seconds.

But you almost for sure don't want to just scatter mysql_ping
throghout normal code.


Yes that is true. I only use mysql_ping in scripts with long idle times (up to one hour idle time), and then I noticed that the mysql connection goes down. Using mysql_ping will not just check that it is alive, but also try to reconnect if it was down.

I'd never use mysql_ping in scripts that have short life length.

/Peter

--
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