Re: Persistent MySQL Connection

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

 



On Mon, June 11, 2007 12:53 pm, PHP Mailing List wrote:
> Can I maintain just one mysql connection resource to all my pages per
> user session. As far as I knows create connection is more expensive
> than
> executing queries ?
>
> Any reference how to make efficient for connection resources ?

Yes, no, sort of.

mysql_pconnect will allow MySQL to re-use a connection *IF*:
  same user/password is asking for the connection
  same process (Apache child, or FCGI process) is asking for connection

Thus, you will need to take the number of Apache children, times the
number of username/password in MySQL, and have enough RAM and
configure MySQL to allow enough concurrent connections for that
number.

You also want a few "extra" connections in case you need to access
MySQL from the shell for backups, and admin tasks.

It turns out to be not that useful for many applications, but still is
for some.

I suspect the connection is expensive because MySQL has to do a heck
of a lot of work in the areas of authentication, locking, and data
integrity per connection...  Ain't no way you're gonna want to bypass
any of that, really...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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