You are here: Re: [newbie] How to minimize DB load? « PHP Programming Language « IT news, forums, messages
Re: [newbie] How to minimize DB load?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация