You are here: Re: How often do I need to connect to MySQL database? « PHP Programming Language « IT news, forums, messages
Re: How often do I need to connect to MySQL database?

Posted by Jerry Stuckle on 03/14/07 03:38

zzapper wrote:
> Hi,
> At present at the top of each of my php pages I reconnect to my
> database
>
> mysql_connect(...);
>
> is that actually necessary/good practice. Isn't there something about
> persistent connections.
>
> --
> zzapper
> Best of VimTips
> http://www.vim.org/tips/tip.php?tip_id=305
>

You do NOT want to use mysql_pconnect(). This does create persistent
connections - but now these connections will be tying up system
resources as long as MySQL is running. And you will still have to issue
mysql_pconnect() at the start of each page. And you will have to keep
at least as many persistent connections available as your peak demand
requires.

mysql_pconnect() might be applicable if you were running 10K or more
connections per second - but for your normal website it will hurt you
more than it will help.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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