|
Posted by seaside on 12/22/06 04:20
seaside schrieb:
> Jørn Dahl-Stamnes schrieb:
>
> > I then changed mysql_connect to mysql_pconnect on the scripts and viola....
> > the amount of new connections to the SQL server dropped to only two.
Additionally, this excerpt from
http://www.php.net/manual/en/features.persistent-connections.php may be
of interest for others, who read this thread:
###
There are a couple of additional caveats to keep in mind when using
persistent connections. One is that when using table locking on a
persistent connection, if the script for whatever reason cannot release
the lock, then subsequent scripts using the same connection will block
indefinitely and may require that you either restart the httpd server
or the database server. Another is that when using transactions, a
transaction block will also carry over to the next script which uses
that connection if script execution ends before the transaction block
does. In either case, you can use register_shutdown_function() to
register a simple cleanup function to unlock your tables or roll back
your transactions. Better yet, avoid the problem entirely by not using
persistent connections in scripts which use table locks or transactions
(you can still use them elsewhere).
###
Navigation:
[Reply to this message]
|