|
Posted by Gordon Burditt on 12/07/06 00:06
>BTW, what are "persistent connections"? Is there a different way than
>using mysql_connect() at the top of any page that needs access to the
>DBMS?
A persistent connection is a connection (to a database) maintained
over multiple page requests and is created with mysql_pconnect().
The main problem with them is that you often end up with so many
persistent connections that the MySQL server slows down or can't
handle that many.
Connections can get put into a number of states that makes them
unsuitable for re-use in a persistent connection:
- Holding a table lock from the last page.
- Default charset set to something wierd.
- Idle time limit has expired before it's re-used, giving you a dead connection.
- Settings of session variables to wierd values unexpected by the page
re-using it. (e.g. autocommit)
- Leaving parts of a transaction uncommitted.
- I don't think this list is nearly complete.
Persistent connections are only shared between calls to mysql_pconnect
with the same host, user, and password, so normally it's only YOUR
other pages using persistent connections that can screw up the
connection state, even in a shared-host situation.
Navigation:
[Reply to this message]
|